Hold to charge

VGXVGX Member Posts: 796
edited November -1 in Working with GS (Mac)
Example...

(A) jump
(B) shoot or hold to charge then shoot super blast

How do I make a hold to charge attribute? One simple example then I can work out the rest.

Thank you :)

Comments

  • old_kipperold_kipper Member Posts: 1,420
    One method would be to first work out how many 'energy points' (or whatever you want to call it) you want to have added and over what time. Then have a timer inside a touch rule that is set up to add points (up to a limit) to an integer attribute based on a timer set at 'every' (enter the time element for each point addition). So it might read something like-

    when actor is pressed + self.energypoints<200

    timer every 0.2

    change attribute self.energypoint to self.energypoints+1

    If you want a health bar to 'fill up' you could make the 'energypoints' a scene or game attribute and have an actor reference this with a constrain and expand with a constrain rule and have another to move it to compensate across the scene so it grows only in one direction.

    something like

    constrain self.size.width to game.energypoints

    constrain self.position.x to 10+(self.size.width/2)

    hope that helps

    kipper
Sign In or Register to comment.