Login | Register

Walking shooting pointing towards mouse

August 28, 2007, 12:28 by death-droid
[loading]
-->
PRO OR REGIRSTED Required

This code was the start of my TDS which never got off the ground so i decided to real lease the code i have done so here it is

This goes in the step event

//look at mouse//
direction=point_direction(x,y,mouse_x,mouse_y)
image_angle=direction

//shooting//
if mouse_check_button_pressed(mb_left) then{
instance_create(x,y,bullet)}

//walking//
if keyboard_check(ord('W')) or keyboard_check(vk_up) then {mp_potential_step(x,point_direction(x,y,mouse_x,mouse_y),4,false)}


For Bullet

//create event
motion_set(point_direction(x,y,mouse_x,mouse_y),25)

//step event
image_angle=direction



Most of this people should already know but if you want them more explained just say.

Comments

Loading comments... [loading]
.
Users logged in:

game maker articles, game maker examples, game maker tutorials, gmtutorials, game maker questions and answers, game maker crash course, how to create games