How do I create a charge shot?

Get help using Construct 2

Post » Sun Apr 20, 2014 6:27 pm

I currently have it set up so pressing Z fires a regular shot. Holding down Z makes the charging animation visible. As a subevent, every 1 second if z is still pressed it increases the charge state by 1 and sets the charge animation to its corresponding level.
Both pressing Z and releasing Z resets the charge state to 0 and releasing Z fires off a regular attack if the charge level is not 3 and fires a charge shot if it is 3.
The problem is that just pressing Z shouldn't make the charging animation visible and add to the charge state, but pressing Z keeps making the charge animation visible and sometimes increases the charge state and sometimes brings it back to 0. It seems the code is conflicting. How do I resolve it so pressing Z fires a shot and only holding down Z starts showing the charging animation and increasing the charge state?
B
5
S
1
Posts: 31
Reputation: 439

Post » Sun Apr 20, 2014 7:09 pm

On button down:
- Every tick: add 1 to VARcharge.
- VARCharge > 20, Trigger Once: Set animation to charge.
On button released, VARCharge > 100: shoot charge shot
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
89
S
30
G
22
Posts: 1,985
Reputation: 20,099


Return to How do I....?

Who is online

Users browsing this forum: beohs, brunopalermo and 15 guests