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

Post Reply  Post Oekaki 
 

Posted By Message

Fish20



Registered
  03/12/2007
Points
  263

VIP MemberPS3 OwnerI like Aliens!I'm a Storm TrooperIt's-a me, Mario!I am an April FoolPicture Me This Round 48 Winner!
6th June, 2010 at 02:22:23 -

I need to shoot in 360 degrees. I'm using trig right now, but my formula isn't working.

Always Set X position to X("bullet")+cos("gun"))*15 and Set Y position to Y("bullet"-sin("gun"))*15.

The gun is shooting in odd directions and when change my angle the bullets angle changes as well how can I alter the formula and/or events to make this work?

I've worked 3 hours on this trying different articles on here, but none of them work or are specific enough to get me to make them work.

Edited by Fish20

 
All your base are in another castle, take this.

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
6th June, 2010 at 04:06:02 -

It should sort of work like that, but I don't get what "gun" is in your formula. What does cos("gun") mean? The gun's direction? Position? It should be the angle in 360 degrees, and not the direction in MMF direction numbers.


Here's one I wrote with MMF creating the bullet and stuff, but Lua calculating the angles:
http://www.create-games.com/download.asp?id=7708

It does more than 360 degrees
The main reason I made it in Lua was because it's just much easier to put formulas into it. (X1-X2) is simpler than XPos("Active1") - XPos("Active2")

If you need a review on trigonometry:
http://www.create-games.com/article.asp?id=1984

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

nim



Registered
  17/05/2002
Points
  7233
6th June, 2010 at 04:10:38 -

Fish, try the example on Nifflas' site. It's simple enough to understand and change.

http://nifflas.ni2.se/?page=Multimedia+Fusion+2

 
//

Fish20



Registered
  03/12/2007
Points
  263

VIP MemberPS3 OwnerI like Aliens!I'm a Storm TrooperIt's-a me, Mario!I am an April FoolPicture Me This Round 48 Winner!
6th June, 2010 at 07:35:01 -


Originally Posted by Muz
It should sort of work like that, but I don't get what "gun" is in your formula. What does cos("gun") mean? The gun's direction? Position? It should be the angle in 360 degrees, and not the direction in MMF direction numbers.



Oh sorry I meant to put in cos(angle("gun")).

Thanks Nim the example helped me alot I got it working now.

 
All your base are in another castle, take this.

Solgryn

Solgryn dot org

Registered
  20/12/2008
Points
  12572

GOTW Winner!VIP MemberWii OwnerIt's-a me, Mario!The Cake is a LieGOTM 2ND PLACE! - APRIL 2009GOTM 2ND PLACE - JUNE 2009PS3 OwnerKlikCast #15 Compo Winner!LOL Sign
You've Been Circy'd!GOTM WINNER - JANUARY 2010I am an April FoolGOTW MARCH 2010 WINNER!Santa Hat
6th June, 2010 at 16:02:36 -

You need to keep the x and y coordinates in variables aswell, and set the objects x and y to those all the time.

 
www.Solgryn.org

Image

Watermelon876



Registered
  16/04/2009
Points
  27

I am an April FoolVIP Member
7th June, 2010 at 02:24:48 -

http://www.gamebuilder.info/world/content/survival-space

It's open source. Follow what solgryn said, he's right. that's a mistake I made.

 
Awesomeness is Watermelon.
*/l、
゙(゚、 。 7
l、゙ ~ヽ
じしf_, )ノ
This is Koji. Copy and paste Koji to your sig so he can acheive world domination.
   

Post Reply



 



Advertisement

Worth A Click