Tag Info

New answers tagged

1

I am also working on a fighting game and I am doing this by having a Move structure which contains different parameters of an attack (or neutral move) including active frames if any. I keep the active frames in a container which I can delete from. Each frame I reset the properties of every hitbox of my character to default, and after that I activate each one ...


1

Easy solution 1 : you can mark each attack move with a unique identifier that is regenerated every move, and mark each character with the identifier of last hit received. If during a frame collision the last hit received id matches the attack id, do not count it as a hit. In case there are more than 2 characters, one attack can still hit multiple ...


2

Basically you have three ways to periodically invoke some code. have a infinite loop with sleeps. use setIntervall to perodically be waken use requestAnimationFrame for when the browser is idle Although this is about animation, it covers the basic crux of the problem: Animating In Code Using JavaScript


0

I'm not sure if you'd like my method but based on what you said, "New Game, Settings, Exit" then I'm assuming the menu would be the main screen right? I'm a texture user , by the way, and not a surface one. //Let's assume that your method of input is a mouse //since this is long, you can create a class for this then recall it in the gameloop //WE CREATE ...


4

As congusbongus notes in his answer, many games benefit from dividing content into "scenes". A scene might represent a particular level, a room, a minigame, or lots of other possibilities, depending on the game. In such a system, menus can be implemented as scenes as well, and this works well for simple games with only a few menus. Personally, I like to ...


2

The typical way to implement this is using game screens or scenes. Your game loop updates and draws the current screen, whatever that may be Your menu(s) live in one screen or set of screens, your game world lives in another screen Choosing certain menu options (e.g. start game) switches the current screen In this sense, it's just a plain programming ...


2

I had to address this same problem, basically you're doing it the right way, updating at a set rate of updates per second, and thus a set speed per second and rendering as fast as possible independently of that speed. That way it doesn't matter how you measure things in your update as long as you keep it consistent it'll be the same speed regardless of how ...


7

In a word, synchronization. If you have some data (your world) which you're reading from one thread (the rendering thread), and writing to in another thread (the logic thread), it is possible that your data will be read in an inconsistent state (for example, half the world has been updated, but not the other half). To maintain consistency, you will probably ...



Top 50 recent answers are included