Waiting for weapon reload.. using wait not working

0 favourites
  • 9 posts
From the Asset Store
Add calm and a lounge vibe to your games with these 8 tracks
  • On LMB I do a sword slash, on RMB I allow the weapon to be "fired". I want a time penalty for firing the weapon which is "WeaponRespawn".

    Here's a code snippet:

    <img src="http://i.imgur.com/wm04Zr1.png" border="0" />

    Problem: First time it works, second time it does not, third it does, fourth it does not, etc.

    On debug I can see "WeaponLaunched" is being set to 0 right away on each 2nd shot. Can't see how this would happen.

  • Try getting rid of the "else" event

  • Don't put it in a sub event, just put it right under the wait statement in the same event. See if that works.

  • Try getting rid of the "else" event

    Then I can fire / slash infinite times at once.. I only want the wep on screen once at any one time and the Else.. delivers that logic.

  • Don't put it in a sub event, just put it right under the wait statement in the same event. See if that works.

    Have tried, same issue..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try using a timer instead of wait.

  • Something like this ?

    simple timer for bullet delay

  • I've also found that Wait and Timer triggers sometimes fail to fire even though the logic of the events looks good. I've also had them stop working for no reason after I've been working on a different part of an event sheet, but nothing consistent enough to put in a bug report for proper analysis (only enough for me to occasionally moan about it! <img src="smileys/smiley2.gif" border="0" align="middle" />).

    My advice would be to do 2 things here:

    1. Add a tripple event containing (1)Sword is on screen Inverted - AND - (2)Swordbull... is on screen Inverted - AND - (3)Trigger Once. Use this to set a variable "player_can_fight_time" to "time + Player.WeaponRespawn".

    2. Check player_can_fight_time < time as a pre-event to your key down checks (in place of the WeaponLaunched = 0 check). That should do it.

    Good luck! Like I said before, I've often found that once a game becomes very complicated with lots of time checks and trigger checks, the triggers sometimes get missed. This has resulted in an enemy not shooting at the player, for example (which can just about be excused) or something like the above problem where the player can no longer interact with the game (= fail!). This time check using an object variable technique might seem to be a pain at first but I've never found it to let me down (I rarely use Wait and don't use the Timer any more and I don't have to solve problems like this either...).

  • Something like this ?

    simple timer for bullet delay

    Timer did the trick, thanks. :)

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