Loops *solved*

This forum is currently in read-only mode.
From the Asset Store
40 ambient sound loops. A wide selection of looping ambient sounds for different locations.
  • Hi Guys I'm back and I'm having a new problem.

    In my game to do a basic attack you need to press the control 'Action' which uses the 'Enter' key. In a lot of games of action games, I noticed that pressing the same button can play other animations. For example:

    Player 1 presses enter and Animation 1 is carried out in game. The second this animation ends a timer is executed to check whether the player has pressed the key again. If he did, the game will play Animation 2. If Player 1 did NOT press the enter key within the time frame and pressed it after the timer, the game play Animation 1 again and the loop is repeated.

    This is often used in action games or Star Wars games(Which is what my game is all about).

    How can this be achieved? Someone please help me as I can't believe I'm having trouble just doing basic attack moves

    ____________________________________________________________________________________

    If you can help please post the solution on this thread, upload or link an example. DO NOT REUPLOAD THE .CAP WITH YOUR VERSION as I want to try my best to learn it myself.

    Note: The events can be found in the 'Lightsaber' event sheet and the Animation 2 is the Lightsaber2 animation.

    Thanks a lot for your time.

    EDIT: Problem solved, read reply 4 for solution.

  • I'm new to this but I'd guess use a private varible

    press 'enter' and private variable = 0 do the action and set the private variable to whatever amount of seconds you want for your time span

    press 'enter' and private variable >0 do the second action.

    just a guess, can't test it at the moment. Maybe someone more experienced will answer

  • I'm new to this but I'd guess use a private varible

    press 'enter' and private variable = 0 do the action and set the private variable to whatever amount of seconds you want for your time span

    press 'enter' and private variable >0 do the second action.

    just a guess, can't test it at the moment. Maybe someone more experienced will answer

    hat is definitely a good idea and is a much simpler solution for this problem. It probably could work, I would need to test it. But there's one problem, how am I gonna define when I press enter a second time and the time span if I did not press it a second time.

    EDIT: I tested it, still got nothing, I have no idea how to make the animation run when when I press 'Enter' the 2nd time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • http://dl.dropbox.com/u/5426011/examples/doubleattack.cap

    req 0.99.9

    or in pseudo code:

    + MouseKeyboard: On key Enter pressed
      + Anakin: Animation "Lightsaber1" is playing
        -> Anakin: Set 'attackAgain' to 1
      + System: Else
      + Anakin: [negated] Anakin: Animation "Lightsaber2" is playing
        -> Anakin: Set animation to "Lightsaber1"
    + Anakin: Animation "Lightsaber2" finished
      -> Anakin: Set animation to "Idle"
    + Anakin: Animation "Lightsaber1" finished
      + Anakin: Value 'attackAgain' Equal to 1
        -> Anakin: Set animation to "Lightsaber2"
        -> Anakin: Set 'attackAgain' to 0
      + System: Else
        -> Anakin: Set animation to "Idle"[/code:2nhaxrna]
    
    If that isn't what you were looking for let me know.
  • http://dl.dropbox.com/u/5426011/examples/doubleattack.cap

    req 0.99.9

    or in pseudo code:

    + MouseKeyboard: On key Enter pressed
      + Anakin: Animation "Lightsaber1" is playing
        -> Anakin: Set 'attackAgain' to 1
      + System: Else
      + Anakin: [negated] Anakin: Animation "Lightsaber2" is playing
        -> Anakin: Set animation to "Lightsaber1"
    + Anakin: Animation "Lightsaber2" finished
      -> Anakin: Set animation to "Idle"
    + Anakin: Animation "Lightsaber1" finished
      + Anakin: Value 'attackAgain' Equal to 1
        -> Anakin: Set animation to "Lightsaber2"
        -> Anakin: Set 'attackAgain' to 0
      + System: Else
        -> Anakin: Set animation to "Idle"[/code:2920jt6o]
    
    If that isn't what you were looking for let me know.
    his is exactly what I'm looking for! Thanks!
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)