External Exam Download Resources Web Applications Games Recycle Bin

Turret


theory



implementation
1. Create Turret and Ball sprites
Center Ball sprite in middle of ball, but position pivot point at base of Turret sprite, and draw left to right:



2. Turret script


3. Ball script
If you wish to complete the clone activity below, then save time by declaring your variables locally to the instance of the sprite:



If not, then variables affected globally will affect all instances of the sprite when implementing this script, which means if a projectile is in flight when another is created, both (i.e. all) will be affected:






questions
1. Variable effects
Explain what happens if you increase or decrease the initial variables:
  1. speed
  2. gravity
  3. wind

2. Clone projectiles
Try it without wind:



Why does this fail if the variables are made / declared global (i.e. For all sprites) instead of local (i.e. For this sprite only)?

3. Gamify
Turn this into a game by adding some of these elements:
  1. still target
  2. moving target
  3. score
  4. limited shots
  5. limited range of rotation
  6. smoother controls
Can you think of other elements to improve gameplay?