ShiVa3D
Noob 2D Movement Question?
All about the StoneScriptRe: Noob 2D Movement Question?
by Guinner » 09 Apr 2012, 09:45
Is there a problem you can't solve?
This is amazing thank you! I've implemented the code into my game, changing quite a bit of it to match my needs but this is the perfect example! Thank you
This is amazing thank you! I've implemented the code into my game, changing quite a bit of it to match my needs but this is the perfect example! Thank you
- Guinner
- Junior Boarder

- Posts: 36
Re: Noob 2D Movement Question?
by DoctorPepper » 15 Apr 2012, 06:08
Keep getting AI Runtime error : [State] AI_Hero.Move_onLoop: attempt to compare number with nil (nHitDist)
logged the value nHitDist. Always get 1 value above 0.7, next line is a crash in
if(this.bJumping ( ) == false and nHitDist > 0.7 )
weird stuff.
logged the value nHitDist. Always get 1 value above 0.7, next line is a crash in
if(this.bJumping ( ) == false and nHitDist > 0.7 )
weird stuff.
-

DoctorPepper - Platinum Boarder

- Posts: 411
- Location: Belgium
Re: Noob 2D Movement Question?
by broozar » 15 Apr 2012, 09:38
do you use 1.9.1? nHitDist returns 0 for me if the ray does not hit anything, not nil.
in any case case, put a
around it.
in any case case, put a
- Code: Select all
if hHitObject~= nil then
--the code in question
end
around it.
Re: Noob 2D Movement Question?
by DoctorPepper » 15 Apr 2012, 13:55
Must be it, i am still using the old good 1.9.0.1
Raycast is all messed up, when the object is in mid air, it keeps returning nil so the object is stuck there. when i move at high speed and hit something, it moves in z axis so the object flyes of the 2d level. (is there a way to limit the z movement?)
edit: srr, it seems ive been using nHit instead of hHit. But the problem with z movement remains
Raycast is all messed up, when the object is in mid air, it keeps returning nil so the object is stuck there. when i move at high speed and hit something, it moves in z axis so the object flyes of the 2d level. (is there a way to limit the z movement?)
edit: srr, it seems ive been using nHit instead of hHit. But the problem with z movement remains
-

DoctorPepper - Platinum Boarder

- Posts: 411
- Location: Belgium
Re: Noob 2D Movement Question?
by broozar » 15 Apr 2012, 17:34
well, please post your entire code then, or preferably an STE, and i will have a look at it.
and i can't tell which axis is z for you - forward/backward or front/back...
and i can't tell which axis is z for you - forward/backward or front/back...
35 posts
• Page 3 of 3 • 1, 2, 3