I’m trying to add a shooting bonus to my game, when the player takes the bonus he will be able to fire missiles, what i did is that a created global variable :
public static shootActivated = false ;
once the player collides with the bonus, i set shootActivated to true and i remove the bonus. in tha player update function, i’m testing all time the value of shootActivated, if it’s true then when pressing SPACE bar the player shoots missiles.
i’m thinking that maybe there is a better way to implement this, may be i don’t have to test all the time the value of shootActivated in the player update function, is there a way that only when the player collides with the bonus then he get notified about being able to shoot missiles.