Page 1 of 1

Mouse Button Down Event

PostPosted: Sun Sep 25, 2005 2:26 pm
by ALK3_Steph
Am I totally missing something cause I cant do anything with the mouse down or up events. Like, I made a really simple create actor when you use the right mouse button, but, alas no luck. Same with the left button, and mouse wheel button. But I have made the target follow the mouse on the X axis so I dont know whats going on. Haha. Any help?

PostPosted: Mon Sep 26, 2005 8:37 am
by Novice
U have to click on the actor that has the event or make a filled region to click iniside of. In my knowlage clicking on an empty screen wont do anything but maybe im wrong.

PostPosted: Tue Sep 27, 2005 5:09 pm
by ALK3_Steph
Ok so I figured out the mouse down event, it does need to be on something clickable, so I made a sensor the size of the screen, and that allowed me to make the shot. But, it would only work if I had the shot set to a parent, which was player in this case. The draw back to that is that if I move my mouse back and forth, it moves the ship along the X axis, but, all the shots stay parented by the ship so they move side to side along with the ship. Blah to it all. Haha

PostPosted: Tue Sep 27, 2005 8:28 pm
by Novice
It realy simple just do this in script editor:
1.on mouse button down crete actor "shot"
on the shot actor do this:
1.On create actor get the angle betwen the mouse and ship using
Code: Select all
angle = direction(ship.x,ship.y,shot.x,shot.y)

2.set directional velocity to 10
3.off screen destroy actor
If you do this on mouse click the shot should be fired from the ship in the direction of the mouse and be destroyed when out of the screen to save memory. You should realy do the moon defender tutorial it will explain it better.