0 Favourites

How to make a global 'charge-up' variable?

  • Edit: Figured it out. Instead of using a While loop, just used an Every X second event + conditions and works fine. Same link is the updated file.

    But which would be better to modify? Set Bullet Speed or Set Bullet Gravity?

    I'm trying to make my character have a variable 'charge-up' throw action. Basically, longer I hold down a button (Q), the further away the bullet (a spear) would go.

    This is what I've got so far: dropbox.com/s/ke33nga8k8dgu9h/Q%20Shot.capx

    Use arrow keys to move around. Q readies the spear, and on release, release it. W to return the spear to re-throw it.

    I'm using a global variable (Throw_Time) to test how long Q is held down. Then I set it a While loop to add 1 to Throw_Time with a delay of 0.3 seconds.

    Then on release, I'm trying to set the bullet(spear) speed to (Throw_Time)*200

    But the speed never varies, no matter how long/short I hold Q.

    I think my While loop for Q isn't working, but I'm not sure :(

    Could someone check it out for me (there's a lot of various events in the event sheet but I tried to mark out the relevant part with comments).

    Edit: Is it because the While loop is adding to the global variable too fast?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)