How do I create a charge shot?

0 favourites
  • 2 posts
From the Asset Store
Shoot balls to destroy as many blocks as possible, at each stage the game will become more difficult.
  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

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