Jump to content


Pathurs

Member Since 02 Sep 2010
Offline Last Active Dec 17 2010 08:36 PM

Posts I've Made

In Topic: Won't "move_towards_point" *solved

28 September 2010 - 08:36 PM

Is this in the Step Event?

In Topic: Missiles

16 September 2010 - 10:52 PM

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:

STEP EVENT:
move_towards(obj_enemymask.x,obj_enemymask.y,*speed*)
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..

In Topic: keyboard help

05 September 2010 - 09:04 PM

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?