Computer Science Canada RPG 360* shooting (trig) |
Author: | rownale [ Wed Sep 06, 2006 6:52 pm ] |
Post subject: | RPG 360* shooting (trig) |
shooting arrows... Ive made a couple RPG games in the past but ive always wanted to implement arrows or projectiles that can be shot wherever the mouse points. (I had this in chasegame but the bullets were "invisible" lol) Another game of mine i decided to just use button/turn based combat sort of thing ( http://www.compsci.ca/v2/viewtopic.php?t=12771&highlight= ) Anyways, I'd like to try to make a game where you can just click on the screen and a projectile will emerge from the players character (a circle lol) and i dont even care if it looks dumb because it starts in the center of the player and moves outwards (although that can be fixed with colour). The game will be played in a top down view. The person will move around if that makes a difference. And I only have some programming done (engine parts). And the bullets can be continuous or just one click=one bullet thing it doesnt matter. So basically I need help with the trig stuff and ive done gr11 math but i still dont understand how to program it and implement it. Plz help thanks |
Author: | BenLi [ Wed Sep 06, 2006 7:06 pm ] | ||
Post subject: | |||
actually, you don't need trig. assuming the arrows travels in a constant rate, you only have to wrry about direction. You don't need to break it down into angles. This is code from the beginnings of my FP last year, it actually tells you the angle
|
Author: | rownale [ Thu Sep 07, 2006 7:19 am ] |
Post subject: | |
ok thanks i couldnt get ur program to work because i didnt have mathdistance but i just found it here lol http://www.compsci.ca/v2/viewtopic.php?t=13177 thanks for the help |
Author: | Clayton [ Thu Sep 07, 2006 2:31 pm ] |
Post subject: | |
if you dont have the Math.Distance function, make one all it is is the distance formula with the parameters being the two points ordered pairs |