If you need to get the angle between two points, say a player and a target, then that is also easy to do and I have put the code required into Rum - http://www.monkeydeadstudios.com/rum.php?page=math [import]uid: 5833 topic_id: 8382 reply_id: 29985[/import]
Just playing with Rum now Graham, thanks for that!
I’ve been struggling with firing an object in a certain direction and I thinks it because I’m using physics.applyForce() is it feasible with that? The reason I ask is that the first two params of that function take an X and Y which to fire from an object that can rotate these values will change based on what direction the object is facing.
It would be easier (I think) if applyForce could just take an angle in which to fire and a velocity.
Gary [import]uid: 7334 topic_id: 8382 reply_id: 30005[/import]
You would place this in the update function instead of the direct position setting code and you may need to constantly update the velocity values based on the bullet if it rotates all the time. [import]uid: 5833 topic_id: 8382 reply_id: 30010[/import]
Awesome that it’s all working now! And glad you like Rum, if you have any suggestions or find any bugs please send me an email. [import]uid: 5833 topic_id: 8382 reply_id: 30154[/import]
@GrahamRanson, where did you learn how to use math.cos, math.sin, etc in game logic? Your code works like a charm, but I want to be able to understand how to apply math.cos to future projects. [import]uid: 14218 topic_id: 8382 reply_id: 42999[/import]
@ spoggles I’d like to say it was learnt in math lessons in school however that’s just not true. When I was in school I never could understand why things like that would be useful. I was naive. If only they used games dev ( with Corona naturally ) in secondary school maths lessons I’d have been much more interested.
Basically just have a look around Google and you will find some tutorials etc on 2D games dev using trigonometry you should be good to go. [import]uid: 5833 topic_id: 8382 reply_id: 43005[/import]
I agree! I’ve gotten better now, this was when I was 15/16 and bored in maths lessons. I’ve since gone to college and Uni and got a better understanding of all that. Still by no means an expert but just enough to be dangerous [import]uid: 5833 topic_id: 8382 reply_id: 43189[/import]
@GrahamRanson A lot of the tutorials I found use C++ as the programming language of choice. Instead of learning a new programming language, I just want to learn the principles of applying math to gave dev. Do you have anything you suggest? [import]uid: 14218 topic_id: 8382 reply_id: 43212[/import]
This might help, I have never used it myself but there seems to be alot on there - http://www.essentialmath.com/ [import]uid: 5833 topic_id: 8382 reply_id: 46305[/import]