The Daily Click ::. Forums ::. Klik Coding Help ::. 360 degree shooting
 

Post Reply  Post Oekaki 
 

Posted By Message

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
23rd November, 2003 at 16:01:42 -

Okay, I have a platformer, mouse to aim gun. But it only shoots in 32 directions, I'm using direction calculator and fastloop for instant hitting. I want 360 degrees! I've tried advanced direction object, but it doesn't seem to work. Maybe a trigonometry idea would be good, although I dont know how to make a bullet shoot at an angle.
If someone could make an example, or post a solution, I'd really appreciate it.

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
23rd November, 2003 at 22:53:51 -

You need maths mate:

always - bullet.x = bullet.x + cos(bullet.alt a) * 10
- bullet.y = bullet.y + cos(bullet.alt a) * 10

Now, you set the alt a of the bullet to it's angle, and the 10 at the end is the speed. I think that should work, but i don't really know trigonometry.

-Andy

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Lazernaut



Registered
  08/09/2002
Points
  1103

VIP MemberThe Cake is a LieIt's-a me, Mario!Wii OwnerPokemon Ball!
25th November, 2003 at 01:34:07 -

Someone should do an article that includes a bunch of different formulars useful for game creation...

 
n/a

Aali [Crazy_Productions]



Registered
  13/10/2002
Points
  843
25th November, 2003 at 07:06:36 -

Pixelate #11 had a good one about trig stuff in games, mostly for c++ tho

Image Edited by the Author.

 
"If Darl McBride was in charge, he'd probably make marriage unconstitutional too, since clearly it de-emphasizes the commercial nature of normal human interaction, and probably is a major impediment to the commercial growth of prostitution."
-- Linus Torvalds, December 5th 2003.

(Darl McBride is CEO of The SCO Group)


this place sucks but don't tell anyone, it's our little secret, ok?

Kris

Possibly Insane

Registered
  17/05/2002
Points
  2017
25th November, 2003 at 07:24:54 -

"Someone should do an article that includes a bunch of different formulars useful for game creation..."

a lot of these already exist... try www.gamedev.net

 
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
25th November, 2003 at 16:19:56 -

Don't worry my problem is solved. many thanks to JonWoG.

 
n/a

Jimmy Brzezicki



Registered
  16/09/2003
Points
  1057
1st December, 2003 at 05:38:40 -

There's another, less mathtastic extension-happy way. Make it so that there's a thick line with hot spot at one end and action point at the other and rotate it. Then always set a small dots possition at the action point. Create another obzect on bounce ball movement ad make it so that when turning, it moves towards the dot, and when it touches the dot the line rotates around 1 unit in the right direction. The bounce ball (you'll probable want it slow) will then make a smooth 32 sided shape when rotating (basically, a circle). When you shoot then, you set value A of the bullet to the difference between the dot's X and the lines X and value B to the Y value difference. Then you use fastloop to reposition the bullets accordingly (X=X+valueA, Y=Y+valueB). This will in fact be more than 360 directions (although it'll need a little fiddling, but I'm sure you can handle that).

 
Why the hell am I on the computer at 1 in the morning? No, don't answer.

RyGuyX



Registered
  29/08/2002
Points
  495
5th December, 2003 at 15:30:58 -

hey, man. I just wrote an article on 360 degree shooting formulas. I should note, in the article, that I was writing it as object 1 was the player and object 2 was the crosshair. Depending on what effect you want to accomplish - there may be easier ways to do it, skipping any asin()*(180/pi) functions. If you want to see an example of what I accomplished with this stuff, check out my tech demo for this game I'm making.
www.kimball-law.com/hg/games/deserted_tdv2.zip

 
----

www.kimball-law.com/hg (huntergamez.tk)

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
5th December, 2003 at 16:03:13 -

Pretty nice game, movement was a bit weird and I think it looks better with the 'tracers' on. Good job.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Mr Coffee



Registered
  04/09/2003
Points
  440
5th December, 2003 at 16:34:21 -

Hmmm, I was able to do 360 degree shooting using the advanced direction object without much trouble. Much easier than doing all that trigonometry.

 
99 percent chance that the above post is 100 percent correct.

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
5th December, 2003 at 17:46:34 -

I couldnt get advanced direction object to work properly

 
n/a
   

Post Reply



 



Advertisement

Worth A Click