« All Events
9 AM – Android Game Development – Gamas
November 13, 2021 @ 9:00 am - 10:00 am
Today We Do:
- We made 3 birds appear on the screen moving to the left.
- We created bird to appear periodically using timer.
- We organized our codes so codes that belong to sprite was moved to its sprite class. For example, the code that is responsible to rotate the background x coordinate was moved from GameView.java into Background.update() method.
- For Bird.java, Player.java and Background.java, we added a new method draw(Canvas) which will be responsible to draw these characters. We moved some of the codes from GameView.draw() into each of these sprite.draw(canvas).
Homework
- Inside GameView.createBird() method, make the bird y coordinate random from 0 to screenHeight.
- Create a new class Bullet.java. This will be a new sprite for bullet/fireball. Use R.drawable.bullet for the image. Look at how we did Player.java and Bird.java to do this one.
- Make the size about 1/5 of the original size.
- Add the update() and draw(Canvas canvas) accordingly. Just like how we did in Bird.java, Player.java and Background.java. Review the class recording if you did not attend the class.
- Inside Bullet.update(), move the bullet to the right.
- Add the Bullet into GameView and make it appear on the screen.