Saturday, 13 April 2013

More Visuals

Follow up on the last post, both Quentin and the drill are in place and working as one. I had to change how they are controlled in order to avoid errors though. I'll explain:

With just the arrow in place, the code for movement and scrolling was all in the one script: The vertical speed increases every step (up to a maximum), if the left mouse button is held down then the arrow rotates to face it, the rotation of the arrow (and a boolean directing left vs right) is used to drive a horizontal speed and reduce the vertical speed accordingly. At the end of it the vertical and horizontal speed are used to make the background scroll up and move the obstacles and coins accordingly.

Player movement is an illusion, the place doesn't move anywhere. Everything else in the world moves. It seemed like a logical choice both in prototyping, development and looking forward. Creating a large world manually would take too much time to implement.

My maths on the vertical vs horizontal movement speed needs tweaking. When going at the extremes of speed the background does not exactly match the characters' direction. If this will be an issue I do not know, only testing with others will tell.

But the characters work out just fine. All the rotation code, collision code, spawning of obstacles and coins, collision with obstacles and updating speed variables is held in a parent 'Drill' class. There is a parent 'Character' class which holds the same rotation and collision with obstacle code as the Drill parent.

Making the character and drill rotate correctly was easy as they were both developed in Illustrator on the same canvas, so could be separated and use a rotation point in the centre of their imported images, which lined up when combined in game.

Today I created the coin pickup and animated sprite:

 photo Coin-01.png

The coin took me a lot longer than I intended because I tried to use a personal logo for the obverse face and give the coin two sides. It took about an hour of messing about to get it working and even then the visual style was too dissimilar. I considered it an indulgence, let it go and moved on. I was able to make this full rotation easily by making gratuitous use of Copy -> Paste -> Reflect in Illustrator. Once the first five frames were made, the rest could be duplicated from that.

Also created were visuals for the main obstacle in the game: A Cherry Bomb!

 photo Cherry-01.png


 photo Spark1-01.png


The bottom image may be a little difficult to see, but it is a series of 6 images making a spark effect for the cherry bomb. Whilst it doesn't have a fuse and does not burn down, the sparks are bright enough and vivid enough to get the message across.

The cherry bomb spawns in a random position with a random rotation, then each 'step' the cherry bomb will spawn in between one and four sparks, again with a random rotation but all start at the tip of the cherry stalk. The sparks themselves check each frame to see if the animation has completed; If it has, it destroys itself.

I realize that making the gumball machine at this point is a bit of an indulgence, so I decided to create a HUD first instead. The game is in need of one and outputting just text to the screen is not good. Even though I managed to get a fancy font working.

No comments:

Post a Comment