space physics
BlitzMax Forums/BlitzMax Beginners Area/space physics
| ||
I am looking to create space like physics. basically how to re create the movement of the oldschool game 'asteroids' any help would be greatly appreciated. thanks! :) |
| ||
There is a great example of different kinds of "space physics" in your example folder under BlitzMax. I'm sitting on my PC at the moment and the folder here is; C:\Programmer\BlitzMax\samples\vidiot\2d_inertia_engine ...but you can find the same example in your installation directory on your Mac as well. Have fun. :-) |
| ||
ok thanks! i guess I should have looked there first. :P thanks again edit: I do not have that example in my samples folder. I have: aaronkoolen birdie breakout digersteroids firepaint flameduck hitoro mak maxgui shooter simon spintext starfieldpong teapot tempest that is all |
| ||
I don't have it either. :( |
| ||
Here's a good resource I found in the tutorials section of the forum. http://www.blitzmax.com/Community/posts.php?topic=48800 There's plenty of help there and in the code archives. I've answered quite a few of my questions on my own by browsing around. I hope that helps. Anything else? :-) |
| ||
thanks! that really got me going on my program! :) |
| ||
Sorry for sending you on a wild goosechase. I'd been trying several samples on my Mac and just assumed that the 2d_inertia_engine was there when the other ones I'd tried was. I didn't expect any of them to not be there in the Mac version. Oops. ;-) Happy you've got things working though. |
| ||
Oh its ok. Do you remember where you downloaded it from? I'd like to look at it too. |
| ||
you can download my asteroids game from my signature link. it's under games. if you can figure it out through all the spagetti. :) |
| ||
I've uploaded it here: 2d_inertia_engine.rar I hope that's okay - it's only a sample after all. If not - I'll remove it again. |
| ||
thanks! im still having trouble with the rotation i dont understand how to rotate the ship. i try using the setrotation command, but I cant get it to work. could someone explain to me in general how it works. not in code just in english unless you have to use code. I want to know how it works exactly. thanks again for uploading it Sokurah B |
| ||
Not sure exactly what you mean you don't understand about SetRotation. It sets the angle at which all future drawing will be displayed. So if you did this (Pseudo-Code) SetRotation(0) DrawImage(1) DrawImage(2) DrawImage(3) DrawImage(4) SetRotation(180) DrawImage(5) DrawImage(6) DrawImage(7) DrawImage(8) You would draw images 1,2,3 and 4 the right way up, and images 5,6,7 and 8 upside down. If you then wanted to draw some images the right way up, you would need to SetRotation back to zero again. |
| ||
well if i had a triangle as my spaceship like in asteroids and i wanted to rotate it to the left when you pressed the left key and vice versa for the right key would I use the setrotation() command? and then have to set rotation for everother image after that so that everything else doesnt rotate? |
| ||
Yes and no. SetRotation takes absolute angles. So you can't use SetRotation to turn an object because SetRotation(1) will always set the absolute angle to 1, it won't turn by one degree. You would have to store the angle of the ship (and anything else you want to rotate) and then add or subtract from it when a key is pressed to turn it. Then you would pass the current angle to SetRotation and then change it back before rendering things you don't want to rotate, yes. |
| ||
One thing that confused me at first was that 0 degrees is, in a way, facing right.Speed = 10 Heading = 0 X:+Cos(Heading) * Speed Y:+Sin(Heading) * Speed SetRotation(Heading) 'Drawing code here... The object will move forward on the X axis. "Up" goes wacky like mirrors in a carnival house. 0.o I'm just getting picky though. Other then that, Gabriel's description is dead on. :-) So much for me not posting any code. Lol. If you still need help feel free to ask. Just remember to be specific. |