Turret
theory
implementation
1. Create Turret and Ball spritesCenter 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 effectsExplain what happens if you increase or decrease the initial variables:
speed
gravity
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:
- still target
- moving target
- score
- limited shots
- limited range of rotation
- smoother controls