brikinhos said:
Can anyone explain to me how fastattack works and how to fix it? Thanks too much.
To explain this properly, I need to get a little technical.
The OpenBOR engine updates itself ~250 times per second. That's GAME_SPEED.
When an attack "hits", all that really happens is during an update the engine discovered the coordinates for an attack box were overlapping with coordinates from the target's body box. A "hit" is registered and depending on various other factors the target loses hit points, goes into a pain animation, and so on. You can probably already see one issue - for good reason, most animations are much slower than the engine's update speed. There might be 50 or more engine updates before a punch retracts from someone's face, and if the engine registered a hit on each one, the target would almost always die instantly from every little jab.
To solve this, each hit detection is given an ID which is then used with a complicated series of checks to ensure one hit is one hit. The target is also given a small amount of invincibility (Game Speed / 5), meaning that for around 50 updates, the target is safe from another hit. However, if you have an animation that has multiple hits in it, and the animation is very fast, some of the hits might miss. To allow quicker consecutive hits in the same animation, Fastattack reduces the invincibility time of the target on hit to (Game speed / 20), that is to say, about 12 updates of invincibility. That's about 0.05 of a second in real time. If you like, you can adjust this manually to make it even faster.
I want both players can hit the enemy at the same time without stop normal combo but not dealing tons of hits.
Technically you can't. Unless an application is multi-threaded, it processes one event, at one time, and that's it. When you see simultaneous hits in games, it is from programing or other tricks made to create that effect by putting the single events together as one on screen occurrence after they happen. OpenBOR can do this too, but we need to know exactly what you're trying to pull off first.
DC