Big prob with Kayak game, rotation.

Game Editor comments and discussion.

Big prob with Kayak game, rotation.

Postby Sgt. Sparky » Tue Jan 23, 2007 6:34 pm

here is the
Code: Select all
if (animpos < angle)animpos += 5;
if (animpos > angle)animpos -= 5;

but if the animpos is 0-5 and the angle is bout' 360 or somthin' the kayak spins round' the other way and it makes the game look stupid :cry: any help would be nice. :D [/code]
and is there a way to use between codes like:
Code: Select all
if (animpos <10, angle > 350)animpos = angle;
??? :)
EDIT: oh, I feel stupid :lol: :oops: I just figured it out. but it is choppy, I am still open to Ideas :D Here is the Code now
Code: Select all
if (animpos < 7, angle > 353)animpos = angle;
if (animpos > 353, angle < 7)animpos = angle;
if (animpos < angle-7)animpos += 5;
if (animpos > angle+7)animpos -= 5;
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby morcior » Tue Jan 23, 2007 8:51 pm

for best results coding this style of movement, it is a good idea to store 2 angle variables.

1. the real angle variable, the angle you render the boat at
2. the directional angle, the angle the boat wants to be facing

Have a piece of code in a timer that converges the real angle towards the directional angle, then you can just have a simple piece of code in the boats drawing event to say animpos = realangle;

You're kind of doing this at the moment but using the animpos variable as the real angle, which is integer data type so you'll get jumpy results. Use float or double for angles, vectors, speeds, etc!
morcior
 
Posts: 83
Joined: Fri Jan 12, 2007 12:16 am
Location: UK
Score: 9 Give a positive score

Postby Game A Gogo » Wed Jan 24, 2007 12:34 am

instead of using "," use "&&", when having some script, it may do the action whiteout order, which cause problems.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Sgt. Sparky » Wed Jan 24, 2007 12:58 am

no thank you morcior, if the animpos = the angle the when I hit the wall all of the sudden the kayak turns a round :( wich does not look realistic :) but thank you for posting a reply :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Game A Gogo » Wed Jan 24, 2007 1:20 am

well then, do this int he draw actor also:
Code: Select all
animpos=angle/360*nframes;

and you can use the code sugjested by morcior
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Sgt. Sparky » Wed Jan 24, 2007 2:16 am

but it does not look realistic, :( Imagine a Plane Flying 750MPH south, then all of te Sudden it is facind North going at 750MPH :) I am content with my code :lol: :oops: I am sorry If I have bothered you. :cry:
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby morcior » Wed Jan 24, 2007 5:45 am

Shouldn't the boat just stop if it hits a wall? The theory I provided would not turn the boat around in such an event!

Oh well you're happy so lets leave it there :)
morcior
 
Posts: 83
Joined: Fri Jan 12, 2007 12:16 am
Location: UK
Score: 9 Give a positive score

Postby Sgt. Sparky » Thu Jan 25, 2007 3:00 am

:? argh, in the game if the boat stopped then you would have to regain all of that speed(wich is not much)and it would make the game less fun, plus there are "rapids"(they don't really look like rapids)round' some of the rocks :D and the boat kinda' turns into the rapids an' stuff :) :o :D
and when it hit a wall going fast and all of the sudden stopped, it would not look all that great :( but maybe somhow I should just get makslane to delet this topic cus' it was pointless to post it in the first place :cry: :( sorry if I seem mad :(
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron