Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Sonic game speed

Author
Message
z3r0mind
19
Years of Service
User Offline
Joined: 11th Aug 2006
Location: Behind you...
Posted: 17th Aug 2006 04:11
I want to try to go for a 2d sonic game but I can't figure out how to make sonic's velocity right. I think this question would make more sense to sonic fans but if someone could show me a simple example of how they made sonic start out walking slow then slowly gain speed into running when making him go right or left.
Lover of games
21
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 17th Aug 2006 17:35
as a devoted sonic fan I know what ur talking about. but I haven't gotten that far with sprites since I use 3d almost all the time. Good idea though making a sonic game

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th Aug 2006 18:53
It's quite straightforward.

You should use floating point variables to store sonic's position and speeds, it keeps things nice and smooth:

Global PLX#
Global PLY#
Global PLXS#
Global PLYS#

So every loop your affecting the PLXS# variable, the players horizontal speed, and this is added to the PLX# variable.

So a loop like this would have a sonic sprite moving smoothly:

Do

movex=0
if leftkey()=1 then movex=-1
if rightkey()=1 then movex=1

`Adjust X speed
if movex=-1 the dec PLXS#,0.1
if movex=1 the inc PLXS#,0.1

`Or dampen it
If movex=0
if PLXS#>0 then dec PLXS#,0.05 : if PLXS#<0 then PLXS#=0
if PLXS#<0 then inc PLXS#,0.05 : if PLXS#>0 then PLXS#=0
endif

`Limit the X speed
If PLXS#<-1 then PLXS#=-1
If PLXS#>1 then PLXS#=1

`Add the X speed to the position
Inc PLX#,PLXS#

Sprite 1,PLX#,PLY#,sonicimagenumber

Sync
Loop

''Stick that in your text and scroll it!.''
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th Aug 2006 18:56
Adding jumping and gravity to that would involve affecting the Y axis in a similar way, except when sonic is standing on something, PLYS# should be at 0, when he jumps set it to 1, and otherwise just reduce it for gravity.

''Stick that in your text and scroll it!.''
z3r0mind
19
Years of Service
User Offline
Joined: 11th Aug 2006
Location: Behind you...
Posted: 18th Aug 2006 03:19
Wow thanks alot Van B. This is gonna own.
Sonic 91 Software
21
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 19th Aug 2006 19:50 Edited at: 19th Aug 2006 19:51
Good idea, but no-one will EVER match the greatness of Sonic Team's creations. From one Sonic fan to another, I had the same idea as you at some point, but do I really want to attempt to add to the greatest series of games ever?

I am a Christian and I know that God loves me. That is what makes my life so great!
Lover of games
21
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 19th Aug 2006 23:06
I'd like to......I'm actually formulating an idea as we speak. course it'll take years to get it done if i'll even start it. i could always just save it for when i have $$$ and can hire people

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
Dark Eternity
21
Years of Service
User Offline
Joined: 10th Jul 2004
Location: Vana Diel
Posted: 19th Aug 2006 23:18
Quote: "I'd like to......I'm actually formulating an idea as we speak. course it'll take years to get it done if i'll even start it. i could always just save it for when i have $$$ and can hire people"


but how will you get $$$ without doing something yourself? sonic games arnt hard to do because the cpu wasnt that powerful back when it came out so it had to be simple, a few things added here and there to make it cooler and maybe a bit better graphics

Scorched Skies is waiting,can you help

AMDAthlonFX-62,NvidiaGeforce7900 512MB X2,RAM4GB
MonoCoder
20
Years of Service
User Offline
Joined: 4th Dec 2005
Location: england
Posted: 20th Aug 2006 00:24
I'm currently working on a big 2D project myself, that's having similar style physics to Sonic games, though I haven't made much progress yet. I'm pretty clued up on the matter, and thus far I have a nice little mouse-directed diving motion working properly, so... perhaps in time.

(Though I'm on DBPRO, this topic caught my attention.)

Hm? I'm the Doctor.
spaces.msn.com/monocoder
Lover of games
21
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 20th Aug 2006 03:27
Quote: "
Quote: "I'd like to......I'm actually formulating an idea as we speak. course it'll take years to get it done if i'll even start it. i could always just save it for when i have $$$ and can hire people"

but how will you get $$$ without doing something yourself? sonic games arnt hard to do because the cpu wasnt that powerful back when it came out so it had to be simple, a few things added here and there to make it cooler and maybe a bit better graphics "


I actually meant a 3D game. anyone familiar with the Dark Leigon? (Archie Comics.) I don't plan on making it yet. it's an idea that I hope someday will see the light. I'm currently allowing people to download the alien hunter game off my web site. I'm currently working on making Alien hunter better by adding all these cool things and stuff. multiple levels, powerups, health, better AI (although i can't wait to buy DarkAI to make this area "easier") I'm still having a little problem with the who gun switching thing but i'll figure it out.

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack

Login to post a reply

Server time is: 2026-07-07 06:48:27
Your offset time is: 2026-07-07 06:48:27