crazzter Posted October 29, 2015 Share Posted October 29, 2015 First of all: I'm really new to this stuff so please bare with me (I'm mostly a backend guy with an urge to gain new skills) How would you go about making one sprite move ten times as fast as another? I'm saying "ten times" and not "twice as fast" on purpose. Twice as fast could probably be accomplished by doing this in the animation loop: sprite1.x += 1; sprite2.x += 2; But jumping 10px would not look very nice :-) Most of all it's about learning to do things right. Not just making it work. Hope my question is not too trivial or stupid TIA! Quote Link to comment Share on other sites More sharing options...
alex_h Posted October 29, 2015 Share Posted October 29, 2015 Don't take this as saying your question is stupid, but... think about it for a minute.If sprite1 is moving at 1px per frame, how can sprite2 move at 10 times that speed without therefore moving at 10px per frame?So the example you proposed for moving at double the speed is also correct for moving at 10 times the speed if simply changed tosprite1.x += 1;sprite2.x += 10;Whether or not moving at 10px per second looks nice depends on factors like frame rate, monitor refresh settings etc.If you are interested in making movement look nice then I recommend reading up on animation with tweens, easing algorithms and so on. crazzter and d13 2 Quote Link to comment Share on other sites More sharing options...
crazzter Posted October 30, 2015 Author Share Posted October 30, 2015 Thanks a lot! I had a feeling it would be the only solution but was afraid I was missing something Well, at least I was getting it right in the first place! I'll jump straight into the reading-material! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.