bubblesnout Posted January 12, 2012 Report Share Posted January 12, 2012 I'm getting back in to MMF for a bit of fun and I'm making a simple static movement engine that honestly works fine for what it's doing. I'm curious about how one could fine tune it if they had very specific requirements for the speed at which their character moves. The basic idea of it at the moment is simply as such: Repeat while 'right' is pressed: set X to X+1. Simple stuff. What governs the speed at which this happens though? At what frequency does this fire? To add a level of control to this, I've added the 'Every' condition to this event, so it fires every 1 hundredth of a second, or every 2 hundredths of a second. This doesn't seem to be overly accurate though. As with that example, you'd expect that when I change it from firing every 1 hundredth of a second to every 2 hundredths of a second that the characters speed would be chopped in half. This is not the case, in fact it doesn't appear to change at all. What sort of thresholds are there here? or am I thinking about this all in the wrong way? I figure with the accuracy of the Sonic Worlds engine to the classic sonic movement it must be possible to be perfectly precise. Link to comment Share on other sites More sharing options...
TailsSena Posted January 12, 2012 Report Share Posted January 12, 2012 An always command means once every frame... Any command currently met will count as always until it's not true. So in yours, its saying that after one second, your X speed will be 60, which is ridiculous. To put that in perspective, Sonic Rush tops off at like... 24-ish. To control it, have X Speed be added to in decimals, like 0.2, instead of one. Whole numbers don't do it with static engine acceleration factor. Link to comment Share on other sites More sharing options...
bubblesnout Posted January 12, 2012 Author Report Share Posted January 12, 2012 Alright great, thanks for the clarification. So basically if my app is running at 60fps, then my character would move 60 pixels per second which sounds right. I haven't built any form of acceleration in so it's either moving or it's not (this is a top-down kind of game by the way, not a side scrolling platformer). Thanks for letting me know how that works, clears things up a bit, Link to comment Share on other sites More sharing options...
TailsSena Posted January 12, 2012 Report Share Posted January 12, 2012 Your character would move at the framerate x the XSpeed... So like 60*3 gets you 120 pixels of movement for Sonic 1. Even in top down, it's the same. Link to comment Share on other sites More sharing options...
bubblesnout Posted January 12, 2012 Author Report Share Posted January 12, 2012 Yeah that's right, so at the moment because I'm adding 1 pixel to Character.X (ie. a speed of 1), he would move 60 pixels every second. If I were to change this to 2, he would move 120 pixels every second. What I'm interested in then, is how I would go about having him move 90 pixels every second for example. Simply setting this 'speed' variable to 1.5 wouldn't work, an object can't move one and a half pixels. Link to comment Share on other sites More sharing options...
BlazefireLP Posted January 12, 2012 Report Share Posted January 12, 2012 It can if you use Floats in said engine. It's not entirely easy to do though. Link to comment Share on other sites More sharing options...
TailsSena Posted January 12, 2012 Report Share Posted January 12, 2012 An object CAN move 1.5 pixels, I do it all the time! It's representing that movement on the screen that's harder. it'll round the first frame to 2 pixels, next frame is a whole number, so it shows up as 3 pixels of movement. 90/60=1.5, so v'ala you use 1.5 as XSpeed. Link to comment Share on other sites More sharing options...
bubblesnout Posted January 13, 2012 Author Report Share Posted January 13, 2012 Oh wow, there you go. Didn't think it would do that by itself, thought you'd have to do all that yourself. Nice, I'll have a play around with it. Thanks guys! Link to comment Share on other sites More sharing options...
Recommended Posts