• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Weird problem with speed.

D

DyingSilence

Guest
Hello everyone.

I'm currently creating a fighting game. The combat is based on states, for example if one fighter is in state "punching" and the other is in state "standing", the victim will go to state "stunned" for a short time and take some damage.

I made it so when a fighter is in air and is punched, he is knocked back. Every mid-air state has it's individual, yet very similar math behind this.

The fighter has vspeed set to 0, speed set to some various ammount and some gravity to slowly fall. His state becomes "falling", and when he touches the groung, gravity and both speeds become 0, and state changes to "fallen". It works perfectly fine, excerpt the case in which the pre-contact state is "jump_kicking". Then the variable "speed" isn't set to 0, despite the set command is in the same block as zeroing vspeed and gravity.

I have no idea why is this happening.

I'd appreciate some help.

Sorry for potentially bad English, i'm a foreigner.
 
A

Aura

Guest
Welcome to the GMC!

You're pretty good with English, so don't worry. ^^

Either way, we'd need to see the complete code in order to be able to give an accurate suggestion or solution, so please post all the relevant code; you can do that by posting the object information of the player object (and the scripts if you're using any).
 

jo-thijs

Member
Hi and welcome to the GMC!

Could you give us the object information of the fighter object?

EDIT:
I didn't even get a message someone posted before me this time.
 
D

DyingSilence

Guest
http://www84.zippyshare.com/v/ZiM90ngV/file.html


Here's the object, documented where necessary, but you don't have to bother anymore - the case is solved!

It turnt out, that jump kicking activated some delayed state change which i overlooked, it's fixed now.

Yet, many thanks for willingness, have a nice day.
 
A

Aura

Guest
Glad you fixed the issue yourself. Please set the status of the topic as solved. To do that, go to Edit Title/Thread Tools >> Edit Title >> Set the topic prefix to Solved.
 
Top