Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: doubt about entity/Component system on: 2011-09-13 18:06:18
I think I understand it a bit better now, thanks a lot!!
2  Game Development / Newbie & Debugging Questions / Re: doubt about entity/Component system on: 2011-09-13 17:47:47
Thanks for replying so quickly Cheesy

So if I understand correctly, components are used both for the logic, like a graphicsComponent for drawing stuff and for keep data like the InfoComponent i said before, is this right?
3  Game Development / Newbie & Debugging Questions / doubt about entity/Component system on: 2011-09-13 17:36:32
Hi guys, I'm trying to implement a entity/component system to my game but there are things that I just don't get.

For example, where should all the data be, in the entity/GameObject/whatever-you-wanna-call-it class or in the component that uses it? With data I mean, for example the health of the player, the weapon it has equipped, the number of grenades it has, etc... Should i have a component like PlayerInfoComponent, or just InfoComponent that keeps that data?


Hope you can point me in the right direction
Thanks in advance
4  Game Development / Newbie & Debugging Questions / Re: problem with Slick2D animations on: 2011-09-09 12:07:57
It seems that for some strange reason, it refuses to add the images for the "boobingLeft" animation, and the index for every image is -1. The funny thing is that that animation is on the third row and should be ok, and even changing the x and y of the images to the first row for example still give me the same error. I tried changing the name of the animation, changing the coords, changing the order, since I'm doing it backwards, I even made a new 256x256 sheet with all the weapons animations and still nothing.

Trying to print out the index still gives me the same outOfBounds error.

update: Using a single spritesheet just for the boobingleft animation works fine, but it misses the point of using spritesheets at all, this is really pissing me off  Angry, also, adding this code to the end of the draw method
1  
2  
3  
4  
5  
6  
7  
8  
try {
         
         new SpriteSheet("sprites/WEAPONS_SHEET_256x256.png",32,32).getSprite(4,6).draw(150,279);
     
      } catch (SlickException e) {
         // TODO Auto-generated catch block
        e.printStackTrace();
      }
draws the correct image just fine.


Another Update: I think i got it, the problem its that i can't scan a spritesheet backwards because the first x argument is the 0 index in the arraylist of the animation, scanning to the left would be like going to the index -1.

Soooo yeah, it was that, i change the spritesheet and now works properly, Thanks ReBirth for the reply!!

Cheers!
5  Game Development / Newbie & Debugging Questions / problem with Slick2D animations [fixed] on: 2011-09-09 03:04:49
Hi guys, I'm a bit desperate here, hope you can help me or guide me in the right direction. The thing is that I'm trying to load the animations for the weapons of the main char (the game is a sidescroller metal-slug style), so, in the constructor i load all the animations on an arrayListHashMap, one for each weapon, i'll make a weapon class eventually but i wanted to try the code first, i have a 128x128 spritesheet for 4 animations, 4 32x32 frames each.

1  
2  
3  
4  
5  
6  
7  
SpriteSheet escopetass =new SpriteSheet("sprites/SHOTGUN_SHEET_128x128.png",32,32);
         escopeta.put("still", new Animation(new SpriteSheet("sprites/SHOTGUN_STILL.png",32,32),1));
         escopeta.put("boobingLeft",new Animation(escopetass,3,2,0,2,true,250,true));
         escopeta.put("boobingRight",new Animation(escopetass,0,0,3,0,true,250,true));        
         escopeta.put("shootingRight",new Animation(escopetass,0,1,3,1,true,100,true));                  
         escopeta.put("Leftshooting",new Animation(escopetass,0,3,3,3,true,100,true));
     


I have the same block code for the other weapons as well,just changing the spritesheet, then in the draw method, i draw the animation depending the facing of the character, controlled with 2 booleans (facingLeft and facingRight)
when i try to run the game, i get an outOfBounds error on the animation class of slick2D.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
}else if (facingLeft)
      {
         if (arma.get("Leftshooting").isStopped())
         {      
            shooting=false;
            arma.get("Leftshooting").restart();
         }
         if (shooting){
         //its firing
           player.get("still"). getCurrentFrame().getFlippedCopy(true, false).draw(this.x,this.y);
            arma.get("Leftshooting").draw(this.x,this.y);
         
         }else if (this.isMoving() && !shooting){
         //its moving            
           player.get("leftWalking").draw(this.x,this.y);
            arma.get("boobingLeft").draw(this.x,this.y); //<----- Having problems in ths line


arma its an arrayListHashmap that contains the anims of the equipped weapon on that moment.

The error:
Quote
Fri Sep 09 02:57:19 CEST 2011 ERROR:-1
java.lang.ArrayIndexOutOfBoundsException: -1
   at java.util.ArrayList.get(Unknown Source)
   at org.newdawn.slick.Animation.getWidth(Animation.java:412)
   at org.newdawn.slick.Animation.draw(Animation.java:326)
   at com.PlayerEntity.draw(PlayerEntity.java:170)
   at com.Game.render(Game.java:145)
   at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:681)
   at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318)
   at com.Game.main(Game.java:46)
Fri Sep 09 02:57:19 CEST 2011 ERROR:Game.render() failure - check the game code.
org.newdawn.slick.SlickException: Game.render() failure - check the game code.
   at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:684)
   at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318)
   at com.Game.main(Game.java:46)

Hope you can help me, its driving me nuts.
Thanks in advance  Smiley

(I'm not sure if this is the right place for the post, if it is not, move it to the right place please)
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

E.R. Fleming (17 views)
2014-07-29 03:07:13

E.R. Fleming (7 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!