I need a code that will set a missile to seek the object types I want it to. I've tried multiple times to get this to work, but I'm stumped. The obj_enemymask was an attempt to get an object to stick to other objects I wanted it to, thus the missile only has to track 1 object, however the "sticking" failed.
if point_distance(instance_nearest(x, y, obj_enemymask).x,instance_nearest(x, y, obj_enemymask).y,x,y)<m_range
m_target=instance_nearest(x, y, obj_enemymask)
m_target_dir=point_direction(x,y,instance_nearest(x, y, obj_enemymask).x,instance_nearest(x, y, obj_enemymask).y);
First off, the mask can be set in the properties window of the object, it's on the left, just select the sprite and it'll use that for collisions, and anything really!
Secondly, you can simply do:
sprite_angle = direction
replace sprite_angle with sprite_index if you don't have Pro!
This code will make the missile go towards the closest obj_enemymask, I can't be bothered making a more customizable one, unless you want it that is..
Hi, i was wondering weather keyboard_key_press() will imitate a keyboard press. I want to make an object with keyboard_key_press(vk_escape) in the global left mouse button event (So when you press the left mouse button it imitates a press of the escape key) Im not trying to exit the game or anything, Im making a macro program.
Why not just copy and paste what the escape button has in it?