The Daily Click ::. Forums ::. Klik Coding Help ::. Platform engine with accel + moving platforms
 

Post Reply  Post Oekaki 
 

Posted By Message

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
10th March, 2008 at 17:15:34 -

Hey guys, does anyone have any pro tips for a platform engine with acceleration and moving platforms? It seems to work great and easy when theres no accel, but introducing acceleration makes things go a little crazy.

Thanks ;D

 
n/a

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
10th March, 2008 at 18:00:55 -

you mean additional acceleration or something (Like the PMO) or just normal acceleration (getting up to the characters max speed)

 
Craps, I'm an old man!

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
10th March, 2008 at 20:58:53 -

As in when controlling a character, they approach their max speed.

 
n/a

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
10th March, 2008 at 21:10:08 -

Yeah, don't add the platform speed into the acceleration. Separate your values.

Av A= Total speed
Av B= Acceleration
Av C= Moving Platform speed
Av D= Deceleration (friction)

Always> Set Total Speed to "Total Speed+ Moving Platform Speed+ (acceleration-deceleration)"

or something like that!

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
11th March, 2008 at 01:22:54 -

Ah, interesting, but I think your variable names confused me (like when people name ySpeed gravity, argh!)

So I think acceleration is actually the player's control over the speed, right? So it'd be something like "inputSpeed" or something. Then I do the max speed control with inputSpeed, such as if player hits left + input speed > -3, sub 0.5 from input speed.

Then total speed = total speed + any changes of the base speed like moving platforms or wind + inputSpeed?

Is that right, or did I totally misinterpret that? I'm a little tired at the moment... ;p

 
n/a

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
11th March, 2008 at 01:52:30 -

That's right. (word word)

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
11th March, 2008 at 18:07:02 -

Okay, I think I got it except for one thing... I'm using a fastloop detectorless engine (theres an example somewhere around here, I can't find it, but I'm pretty much basing it off of that one.) It can do slopes upward (but I want them to stick while going downward, still working on that...) but a problem arises when using the base speed modifiers.

Lets see if I can try to explain it coherently. It runs through fast loops as long as the total speed is > than 10 or < than -10. The total speed = xSpeed (the input) + xSpeedBase (any modifiers, like moving platforms or wind). When the fast loop runs for say total speed > 10, then it moves it one pixel to the right and checks for collision stuff. If theres a collision and its not a slope, then it stops the xspeed and also knocks the xspeed down based on a bounce coefficient (0 - 100, if its 0 then it stops), and it also sets the total speed to 0. It does this for the opposite direction as well.

When the player pushes a button, it accelerates their xspeed by some value, lets say 2. The problem arises when the player ends up on the wall pushed up against it by the xSpeedBase value, and cant accelerate enough to escape the wall collision. So for the value of 2, everything is fine until I set the xSpeedBase to anything above 10. the player gets stuck to the wall and can't move.

I'm not sure if thats enough info, or explained clearly enough, but any thoughts are welcome ;p

 
n/a
   

Post Reply



 



Advertisement

Worth A Click