The Daily Click ::. Forums ::. Klik Coding Help ::. Acceleration in static engines question
 

Post Reply  Post Oekaki 
 

Posted By Message

xXBlazefirelpXx



Registered
  14/06/2010
Points
  45
17th December, 2010 at 23:15:34 -

I've been trying to get a smooth static engine going for ages. I finally did that. But my main concern now. Is acceleration. Now, most of you probably know this already. But for some reason when you Set Xpos of an object to itself + AlterableValueA. When you add your acceleration to AlterableValueA and lets say that the acceleration equals "0.1".

How is it that when it is added to the AlterableValueA and goes above 0.1, 0.5 and 0.9 that it doesn't move? I know it is possible to make an active move with this expression smoothly with a value of at least 0.1 but not HOW to achieve it.

I've tried everything I can think of but I just don't know how to make an active Smoothly accelerate. That isn't the whole ordeal though. The other this is when my value of AlterableValueA >= 1.5, when the deceleration which is " 0.1" subtracts from it. Why does the value not go right to 0? "The decel works either way < and > to shift it back to 0 in the speed of the decel".

Any ideas on how I can achieve this?

Thanks for any help in advance.

 
-----------------------------------------------

HorrendousGames

Sourpuss

Registered
  31/10/2009
Points
  481

VIP MemberEvil klikerGame Of The Week Winner
17th December, 2010 at 23:48:34 -

that's because MMF2's Built-in XY values don't hold floats. In order to work around this, set the XY position to two alterable values, call them XPos and YPos, and then just manipulate those values anytime you want to move your character. If that doesn't work, keep the code and muliply it by 1.0, and that should work.

 
/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/
That Really Hot Chick
now on the Xbox Live Marketplace!

http://marketplace.xbox.com/en-US/Product/That-Really-Hot-Chick/66acd000-77fe-1000-9115-d80258550942

http://www.create-games.com/project.asp?view=main&id=2160

xXBlazefirelpXx



Registered
  14/06/2010
Points
  45
18th December, 2010 at 00:29:33 -

Ahhh, thankyou! That worked a treat. I actually understand a lot more now that I know this. One more thing though. How do I solve this problem where My Xspeed when the decel code does the subtraction and addition that is goes to something like "-409592e" rather than "0". How is this solved?

Edit: Oh my god I'm having some serious problems here........
http://dl.dropbox.com/u/5505419/MFA/Static%20Acceleration%20Testing%20v0.1.mfa

What is wrong with it D: .

Edited by xXBlazefirelpXx

 
-----------------------------------------------

HorrendousGames

Sourpuss

Registered
  31/10/2009
Points
  481

VIP MemberEvil klikerGame Of The Week Winner
18th December, 2010 at 05:25:22 -

I'll take a look at it, and by the way, dropbox is kick ass, I just started using it myself.

Edit: Just for safety's sake, multiply any changes in your movement by 1.0 (just put the whole code in parentheses and throw the *1.0 at the end). Then have a separate command that says "if Xspeed is greater that -0.1 and lower than 0.1, set Xspeed to 0. You loose that little point, but it makes sure that you don't have that extra run off. Part of the issue is that it's getting little fractions of 0.1 at times, and once it close enough back to 0, then it does the closest thing without going over. The final measure for security is to take your code at the top that says "always set XXfloat to XXfloat + Xspeed and YYfloat to YYspeed", copy the event, and on the top one, delete the xxfloat code and on the bottom delete the YYfloat code. duplicate the XXfloat code and on both change the always to "if Xspeed is greater than 0.1" and "if Xspeed is lower than -0.1" respectively. That should fix things up pretty good.

Edited by HorrendousGames

 
/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/
That Really Hot Chick
now on the Xbox Live Marketplace!

http://marketplace.xbox.com/en-US/Product/That-Really-Hot-Chick/66acd000-77fe-1000-9115-d80258550942

http://www.create-games.com/project.asp?view=main&id=2160

xXBlazefirelpXx



Registered
  14/06/2010
Points
  45
18th December, 2010 at 13:28:30 -

Yeah it is =3.

I'll try to fathom what you just said and apply it to my engine now. Bare in mind these float things are kinda new to me so I tend to get a bit confused .

Edit: Yeah, I don't seem to understand what you where saying on the last part. The Xspeed fix worked though.
http://dl.dropbox.com/u/5505419/MFA/Static%20Acceleration%20Testing%20v0.1.mfa

This is what I got now.


Edited by xXBlazefirelpXx

 
-----------------------------------------------

HorrendousGames

Sourpuss

Registered
  31/10/2009
Points
  481

VIP MemberEvil klikerGame Of The Week Winner
18th December, 2010 at 18:30:31 -

Image

that's what I meant, that event should be the same for all three, except the always event contains the YYfloat=YYfloat+Yspeed. I didn't get a chance to look at your jump code, although it's not working right, he falls really slow and jumps automatically every time he hits the ground, not sure if you got that on your end.

 
/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/
That Really Hot Chick
now on the Xbox Live Marketplace!

http://marketplace.xbox.com/en-US/Product/That-Really-Hot-Chick/66acd000-77fe-1000-9115-d80258550942

http://www.create-games.com/project.asp?view=main&id=2160

xXBlazefirelpXx



Registered
  14/06/2010
Points
  45
18th December, 2010 at 19:32:39 -

I still don't quite grasp it =/. I can't tell where what you are trying to show me is located.
Would you mind if you showed me the changes you made in my mfa to make it work?

 
-----------------------------------------------

xXBlazefirelpXx



Registered
  14/06/2010
Points
  45
19th December, 2010 at 17:10:58 -

Could someone please explain how the general setup in a static engine using floats works please?

 
-----------------------------------------------

HorrendousGames

Sourpuss

Registered
  31/10/2009
Points
  481

VIP MemberEvil klikerGame Of The Week Winner
19th December, 2010 at 17:15:08 -

hey sorry, I've been a bit busy, I'll try to get up the file sometime today, if not tomorrow.

 
/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/
That Really Hot Chick
now on the Xbox Live Marketplace!

http://marketplace.xbox.com/en-US/Product/That-Really-Hot-Chick/66acd000-77fe-1000-9115-d80258550942

http://www.create-games.com/project.asp?view=main&id=2160

HorrendousGames

Sourpuss

Registered
  31/10/2009
Points
  481

VIP MemberEvil klikerGame Of The Week Winner
19th December, 2010 at 21:07:59 -

http://dl.dropbox.com/u/16909290/Static%20Acceleration%20Testing%20v0.1s.mfa

That's what I had time for today, I changed a few things around. The only thing I had a bit of trouble with is your slope, well, going down at least. Going up isn't an issue, which is about the opposite of what it was before.

I changed some of the ways the initial values are loaded, so you can change them via the alterable value editor, rather than having to change the code each time. Just remember that the variables I did change are divided by 100 at the start of the frame. I don't have time to explain everything at this moment, but if you get lost, just let me know and I'll get back to you as soon as I can.

 
/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/
That Really Hot Chick
now on the Xbox Live Marketplace!

http://marketplace.xbox.com/en-US/Product/That-Really-Hot-Chick/66acd000-77fe-1000-9115-d80258550942

http://www.create-games.com/project.asp?view=main&id=2160

xXBlazefirelpXx



Registered
  14/06/2010
Points
  45
20th December, 2010 at 02:38:31 -

I'd like that very much, when you can. Thanks very much for your help.

Is there no easier ways to get precision movement without complexities? Preferable as simple as possible.

Edited by xXBlazefirelpXx

 
-----------------------------------------------

HorrendousGames

Sourpuss

Registered
  31/10/2009
Points
  481

VIP MemberEvil klikerGame Of The Week Winner
20th December, 2010 at 19:19:11 -

Okay, so basically under configuration set up, I deleted the one code you put under possible fix, I don't remember what it was, but that was what you was causing your thing to stick to the side. I replaced it with the code you had originally, except in two lines instead of one. I didn't add that safety measure I was talking about, so I just left it alone. I don't think I changed anything in the X movement code, I did add to each of the deceleration codes an extra "repeat while moving left/repeat while moving right" conditions, which may or may not fix certain issues/cause problems, so keep an eye on that code. I just completely deleted the Slopes group.

Y movement is where I did most of my changes. Your jump/gravity concept is right on track, especially for not creating that obnoxious triangular jumping. Anyways, the guy bounced up every time the loop in the Y movement ran. It was mostly due to the conditions for the event and the actions in the loop. So basically, I edited the two detectors you had so they were each 1 pixel tall, and one is placed one below the other. The bottom one checks to see if the player is touching the ground (as you had it before) and the top one checks to see if the player is on top of the ground. So if both detectors are in the ground, it knows that the player is inside the ground and it causes the player to float up with a loop. If only the bottom one is in the ground, it knows that the player is on top of the ground. For gravity, I kept your gravity actions, I just changed the two conditions to "If Yspeed is different than 0" and "player is not overlapping backdrop". That just makes it so if you jump, it starts hitting the player with gravity, and if the player is over the air, then it starts hitting the player with gravity. For the Jump code, I got rid of those different conditions and set it to "if button is pressed and Y speed is = 0, then jump.

In the config setup, under the "start of frame" event, I changed some of your initializing variables into code that sets them into floats with two decimal places, so if you ever need to change the values, you can do that in the object properties, which is much quicker than having to do each individual line of code. The variables are "X accell" "X decel" "Max X speed" "Jump strength" and "gravity strength". Just remember 100 will equal 1.00.



 
/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/-=?=-/
That Really Hot Chick
now on the Xbox Live Marketplace!

http://marketplace.xbox.com/en-US/Product/That-Really-Hot-Chick/66acd000-77fe-1000-9115-d80258550942

http://www.create-games.com/project.asp?view=main&id=2160
   

Post Reply



 



Advertisement

Worth A Click