schmevie15 Posted April 15, 2016 Share Posted April 15, 2016 Hey all I have this square I am rotating in my simple plat former and it moves along the straight ground perfectly. I am using: enemy.body.rotateLeft(450); This rotates the enemy perfectly, and moves it along, but I also have these hills in my game and when the enemy square encounters the hill it has a terrible time trying to get up it. Is there some sort of property that I can set that would help with this perhaps mass? Or any ideas on how to resolve this? Thanks! P.S I've attached a picture of the square on the hill for reference. Thanks! Link to comment Share on other sites More sharing options...
Fractal Games Posted April 16, 2016 Share Posted April 16, 2016 I would do this manually: 1.) Set a pivot to the bottom right corner. 2.) Rotate manually 3.) Go back to 1.) Link to comment Share on other sites More sharing options...
schmevie15 Posted April 16, 2016 Author Share Posted April 16, 2016 Hey there thanks for the answer! im not sure exactly what you mean though? Should I use anchor.setTo to set the anchor/pivot point, And then how can I rotate manually?? Thanks! Link to comment Share on other sites More sharing options...
Fractal Games Posted April 16, 2016 Share Posted April 16, 2016 22 minutes ago, schmevie15 said: Hey there thanks for the answer! im not sure exactly what you mean though? Should I use anchor.setTo to set the anchor/pivot point, And then how can I rotate manually?? Thanks! Hey, I think (not sure) that the difference between pivot and anchor is that the pivot does not change the position of the sprite. So set the pivot to 1,1 initially. Rotate 90 degrees (the sprite), Change the pivot to the new point (1,0). I have drawn a picture, hope it helps and you make it work. By manually, I mean directly to the sprite, without physics. If you can't make it work and are willing to share your code, i can try to play with it a bit in my spare time. Link to comment Share on other sites More sharing options...
schmevie15 Posted April 17, 2016 Author Share Posted April 17, 2016 Hmmm yea I guess I kind of need the physics here if you wanna take a look I'd really appreciate it!https://dl.dropboxusercontent.com/u/15582110/Kirko/index.html so if you press space you can move with the arrow keys at around 17700 the box appears! Let me know! Thanks! Link to comment Share on other sites More sharing options...
rgk Posted April 17, 2016 Share Posted April 17, 2016 You basically want to enable slopes in arcade physics? Its possible, I did something like this with bitmap data, but I would just get two points some how (based on your logic) and then set the angle to the sprite. Link to comment Share on other sites More sharing options...
Fractal Games Posted April 17, 2016 Share Posted April 17, 2016 I see what the problem is. As you have already made it work very well, I would just suggest that you use a variable inside your rotateLeft method. If you are on a steep slope the variable will be higher, if you are on a straight line it can be 450 (mby smaller if you are going downhill). You can change it manually, depending on the position of your enemy. How does that sound? Link to comment Share on other sites More sharing options...
Recommended Posts