How do I do a click-and-hold charge up shot?

  • Hey guys!

    Brand new to Construct 2, finished the tutorial, I wanna add a megaman style click and hold charge up shot which will do twice the damage.

    Already made the graphic for both the bigger bullet, and the "charge" flash which really I am just doing a slow fade in. Also I know how to double the damage done.

    My only real problem is with the mouse options there seems to be no click and hold after x amounts of seconds then do x command (like spawn bullet flying at hideous monster).

    Assuming I have to work with the while left click is down command I just don't know how. Or possibly on click release?

    Already messed around with a few things but I feel I am stuck at this point.

    Any feedback, pointers would be tanfastic. Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • ( Global or local variable can also be object variable )

    Add Variable Charge set to 0

    Add Variable Damage set to 2

    ( Event for the "Charging" effect )

    Event :

    If Charge = 0 ----> Damage = 2

    If Charge = 1 ----> Damage = 3

    If Charge = 2 ----> Damage = 4

    If Charge = 3 ----> Damage = 5

    ( Event for set the maximum charge of the Weapon )

    Event :

    Evry tick --->

    Charge = ( Max Charge for exemple 3 seconds ) 3 ----> Set Charge to 3

    ( Event who define how many time you charge your weapon )

    Event :

    Evry 1 seconds ---->

    On mouse button is down ---> add 1 to Charge

    ( Wepon event )

    On Mouse button released ----> Spawn Bullet

    -----> Set Charge to 0

    ( Ennemy Side )

    Event :

    On bullet overlapping ennemy ----> Destroy Bullet

    -----> Substract Damage to Ennemy.Life

    Hope it's what you need ! =)

  • Exactly what I needed thank you SO much!

  • ( Global or local variable can also be object variable )

    Add Variable Charge set to 0

    Add Variable Damage set to 2

    ( Event for the "Charging" effect )

    Event :

    If Charge = 0 ----> Damage = 2

    If Charge = 1 ----> Damage = 3

    If Charge = 2 ----> Damage = 4

    If Charge = 3 ----> Damage = 5

    ( Event for set the maximum charge of the Weapon )

    Event :

    Evry tick --->

    Charge = ( Max Charge for exemple 3 seconds ) 3 ----> Set Charge to 3

    ( Event who define how many time you charge your weapon )

    Event :

    Evry 1 seconds ---->

    On mouse button is down ---> add 1 to Charge

    ( Wepon event )

    On Mouse button released ----> Spawn Bullet

    -----> Set Charge to 0

    ( Ennemy Side )

    Event :

    On bullet overlapping ennemy ----> Destroy Bullet

    -----> Substract Damage to Ennemy.Life

    Hope it's what you need ! =)

    and if i have 4 different projectile sprite? there is the basic bullet, the lvl 1 charge, lvl 2 charge and lvl 3 charge how would i make that?

  • > ( Global or local variable can also be object variable )

    > Add Variable Charge set to 0

    > Add Variable Damage set to 2

    >

    > ( Event for the "Charging" effect )

    > Event :

    > If Charge = 0 ----> Damage = 2

    > If Charge = 1 ----> Damage = 3

    > If Charge = 2 ----> Damage = 4

    > If Charge = 3 ----> Damage = 5

    >

    > ( Event for set the maximum charge of the Weapon )

    > Event :

    > Evry tick --->

    > Charge = ( Max Charge for exemple 3 seconds ) 3 ----> Set Charge to 3

    >

    > ( Event who define how many time you charge your weapon )

    > Event :

    > Evry 1 seconds ---->

    > On mouse button is down ---> add 1 to Charge

    >

    > ( Wepon event )

    > On Mouse button released ----> Spawn Bullet

    > -----> Set Charge to 0

    >

    > ( Ennemy Side )

    > Event :

    > On bullet overlapping ennemy ----> Destroy Bullet

    > -----> Substract Damage to Ennemy.Life

    >

    > Hope it's what you need ! =)

    >

    and if i have 4 different projectile sprite? there is the basic bullet, the lvl 1 charge, lvl 2 charge and lvl 3 charge how would i make that?

    Couldn't you just use instance variables on the projectiles?

    Oh If you mean you have different images for the different charge, the easiest way would be to use frames or animations for them and set them according to the projectile charge.

    Or on bullet fired and charge=1 spawn lvl 1 charge, on bullet fired and charge=2 spawn lvl 2 charge

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)