Edited by Baily, 27 July 2007 - 01:47 PM.
Point And Click
#1
Posted 26 July 2007 - 03:00 PM
#2
Posted 26 July 2007 - 03:31 PM
x=mouse.x y=mouse.y
Next, use the drag'n'drop feature Move to Point
instance_create(character.x,character.y,obj_moveto)
EDIT: also found this, courtesy of kroko0611:
var instance;
instance = instance_create(x,y,<obj_character>)
with(instance) motion_set(point_direction(x,y,mouse_x,mouse_y),<speed>)
I edited the quote to fit your situation, hope these tips help. I like the instance method better but the code can also work. Depends on designer style i guess.
Edited by iceflame1019, 26 July 2007 - 03:37 PM.
#3
Posted 26 July 2007 - 08:44 PM
#4
Posted 26 July 2007 - 08:53 PM
Create obj_moveto. In the Events tab, find Global Mouse Left
Now:
Now, add this icon:
In the x and y fields of this window, put obj_moveto.x and obj_moveto.y, and then whatever speed you want.
This is for my method. I'm trying to figure out how to simplify kroko0611's code but I don't think I can.
Edited by iceflame1019, 26 July 2007 - 08:55 PM.
#5
Posted 27 July 2007 - 12:03 AM
#6
Posted 27 July 2007 - 06:59 AM
in object_moveto CREATE EVENT add this:
move=0 mousex=0 mousey=0
In object_moveto STEP EVENT add this:
if mouse_check_button(mb_right) = true
{
move=1
if move=1
{
mousex=mouse_x
mousey=mouse_y
move_towards_point(mousex,mousey,3)
}
}
if distance_to_point(mousex,mousey)<20
move=0
if move=0
speed=0Ok thats all.. just put object_moveto in a room, and watch it work
if you cant get it, i made this example for you: Download Point & Click
Edited by chokobo, 27 July 2007 - 07:10 AM.
#7
Posted 27 July 2007 - 01:41 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











