• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Marinka Brussel
      Imagine a game where the characters are not defined by body regions, but rather, each body region consists of thousands of components, which would kind of replicate the real world where we consist of molecules, atoms - that would open up many, many new possibilities for creative gameplay. Can this be done on any scale with today's technology, or would the games simply require too powerful of a computer to even be playable? Are there any theoretical limits to this? Thanks
    • By Dijsktras
      Hi all,
      Does anyone here know if coloring book games are popular among little kids?
      If yes, I have the following questions:
      Do kids tend to color the same image over and over again? UI is supposed to be 'childish and crowded' or 'flat and peaceful'? Does 'kid songs' matter as in-game music? (In my current project, we have found that the audio is ignored by the adults) Anything you would like to add and I should consider?  
    • By Pasha Gubin
      Hey guys, wanna introduce to you my new arcade game!
      I'll be very grateful if you leave your impressions and recommendations in the reviews. Please, don't judge strictly, my first experience. Have a nice day!)
      Google Play: https://play.google.com/store/apps/details?id=com.ReikoApps.LeapGameSpeedEvol
    • By Eios
        I have coded small games and put some of the features from them into a platform game. But I know my art is not appealing and I don't want to plan the story and cut scenes out. That is why I am posting on the collaboration forum to see if anyone wants to make a game out of this.
      Only hobbyists apply. Please don't change your mind about it being a hobby. PM me when making your application.
      My platform game includes:
      Camera and Movement
      Moveable camera and not binded to player when pressing middle mouse button.
      Bug free jump.
      Player direction following mouse cursor.
      Good collisions.
      Platforms and diagonal slopes.
      Stored Statistics
      Level up with statistics.
      Health bars.
      Save system with continue room.
      Basic attack.
      Self heal.
      Attack and pull enemies back.
      Attack and throw enemies in the air.
      Essential Rooms
      Zoning to a new room.
      Menu with sounds.
      Game over room.
      Randomized rooms.
      Text Dialogue
      Interacting with NPC displays a message.
      Ending conversation with a key press.
      Text typing itself.
      Fast forwarding text with a key hold.
      P.S. I know everyone suffers from jealousy if someone starts selling the game and forget about the other people that worked on it. That is why we need to make sure that we use Discord. But I do not plan to sell the game.
    • By Tordin
      I have been working on a Scifi RTS for some time and have come a long way with the coding and such. I am trying to put 10-20h a week into the game and it seems to been working out good so far. 
      previously i have worked on multiple AAA titles in the video game industry and as well as some indiegames but decided to start making my own indiegames. Problem is that i suck at making art. =)
      So i am looking for someone who wants to help out to make the game look greate by creating 2d art. It mainly consist of isometric art but there are some ui elements and regular 2d perspective aswell.
      Prefebly you should live near the nordic regions and also be able to put in some hours weekly to the project. 
      If you are intressted pm me and i will tell you more indetail stuff about the game and the idea.
      hope to hear from all you crazy good people.
  • Advertisement
  • Advertisement

How should I go about blocking input to wait for an animation to finish

Recommended Posts

Lets say I have a character with a shooting animation that plays every time I hit the space key. I need to block input to assure that the animation finishes before another action is taken. What is a common approach to doing this? Right now, I'm using a variable that is a set to the total number of seconds the animation is. When the variable is zero player input is allowed again. Is there a better way? I'm using Python and Pygame for a 2D game.

Share this post

Link to post
Share on other sites

No, that's pretty much the standard way to rate-limit anything. You can store it as "time left" (relative) or "time the command becomes available" (absolute) but that's more a preference thing. Just don't mix the two, that gets confusing fast.

Share this post

Link to post
Share on other sites


Ideally every animation system would have callbacks which can be registered. If you are writing your own system then you should allow a function callback to be registered along with the animation and allow the callback to called at a particular point in animation. 

You can use this function callback to actually decide whether to set any state or to allow input or to play a particular sound etc. Don't do it with seconds separately as that will cause other bugs which will soon become harder to fix.



Edited by Kreative Pulp

Share this post

Link to post
Share on other sites

Hi ,

When you draw animation , you do it by drawing each frame.So you know how many frames you have in animation and the current one.From this you know when the animation is over  and like Kreative Pulp said you can call a callback or just have some if statement.But I suggest you read about states and how to use this concept.You can have a concept of your character being responsive or not.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement