First, you need an actor to catch mouse clicks. Either use a filled region or an actor that follows the mouse using the FollowMouse function. If it follows the mouse, it's a good idea to make it a largish circle or something. Then set visibility state to DONT_DRAW_ONLY, and you can change the cursor if you like. Now, you have two options: right-click on the sensor actor, say add new activation event, set it to mousebuttondown->left mouse button, and select your player as the receiving actor, or ad a mousebutton down script editor event with
- Code: Select all
sendActivationEvent("Player");
Now on your player actor, add a new event, Activation Event, from your mouse sensor, and use a CreateActor to create a bullet. On the bullet's create actor event, say
- Code: Select all
directional_velocity = 10;//adjust value to your preference
angle = direction(xscreen, yscreen, xmouse, ymouse);