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

0 favourites
  • 1 posts
From the Asset Store
75 power-up sound effects; bonus and notification sounds, fanfares, harp glissandi, stabs, clock ticks, etc.
  • 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:

    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?

  • Try Construct 3

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

    Try 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)