Graphic update : Doors, switchs, gas leaks, moving obstacles, items
During the past 3 days, I drew. And the good news, for me, is that I think I'm done with the drawings for the libGDX Jam. I have everything I need for my game. I could do more, but, I don't have time, the jam ends in 8 days !
But well, I have the minimum to create levels : a few tiles for the background, and sprites for every objects of my game. At last !
The code
Basically, for the code, I have two draw methods, in the Obstacle.java, and I call the needed method depending on the need to use a NinePatch or a TextureRegion.
Here are the draw() methods :
public void draw(SpriteBatch batch, TextureAtlas textureAtlas){ batch.setColor(1, 1, 1, 1); batch.draw(textureAtlas.findRegion(stringTextureRegion), this.body.getPosition().x - width, this.body.getPosition().y - height, width, height, 2 * width, 2 * height, 1, 1, body.getAngle()*MathUtils.radiansToDegrees); } public void draw(SpriteBatch batch){ batch.setColor(1, 1, 1, 1); ninePatch.draw(batch, this.body.getPosition().x - width, this.body.getPosition().y - height, 2 * width, 2 * height); }
So... what did I drew during these days ?
Light Obstacle
This sprites are used with the ObstacleLight.java. For now I have to sprites : one for boxes with square proportion and one for rectangles. These are wooden box sprites... doesn't really suit the space theme, I know. If I have time during next week end, I'll draw some metal boxes.
Gas leak
These sprites are used with the Leak.java.
For the gas leak, I had to create an animation, so I drew 10 sprites, and the Leak.java has its own draw() method :
public void draw(SpriteBatch batch, float animTime){ batch.setColor(1, 1, 1, 1); batch.draw(leakAnimation.getKeyFrame(animTime), this.body.getPosition().x - width, this.body.getPosition().y - height, width, height, 2 * width, 2 * height, leakScale, 1/leakScale, leakAngle); }
Doors and switch
These sprites are used with the ObstacleDoor.java and the ItemSwitch.java.
The ItemSwitch.java has its own draw() method to be able to draw the right sprite depending on the switch being in the "on" or "off" state :
public void draw(SpriteBatch batch, TextureAtlas textureAtlas){ batch.setColor(1, 1, 1, 1); if(isOn){ batch.draw(textureAtlas.findRegion("SwitchOn"), this.swtichBody.getPosition().x - width, this.swtichBody.getPosition().y - height, 2 * width, 2 * height); } else{ batch.draw(textureAtlas.findRegion("SwitchOff"), this.swtichBody.getPosition().x - width, this.swtichBody.getPosition().y - height, 2 * width, 2 * height); } }
Revolving obstacles
This sprite is used with the ObstacleRevolving.java.Moving Obstacle
This sprite is used by the ObstacleMoving.java.
Items : Fuel and oxygen refill
These sprites are use by the FuelRefill.java and OxygenRefill.java.
Level Exit Door
This sprites are used by the Exit.java.
This one took me A LOT of time. I wanted to create an animation for the level exit door. I created the animation with Spriter Pro.
Just for fun, here is a speed up video showing the process of creating the animation with Spriter Pro :
Drawing : Done !
Next : Sounds
OMG