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

Get help using Construct 2

Post » Thu Apr 18, 2013 7:50 am

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?Byakko2013-04-18 08:14:42
Create HTML5 games
Posts: 27
Reputation: 697

Return to How do I....?

Who is online

Users browsing this forum: savaslt and 17 guests