Jump to content


Photo

Point And Click


  • Please log in to reply
6 replies to this topic

#1 Baily

Baily

    GMC Member

  • New Member
  • 218 posts

Posted 26 July 2007 - 03:00 PM

Yah, Baily again. This is probrably a ferquent question, but how do I make a point and click adventure game?I want it so if you click somewhere,the player will walk towards the point you clicked.

Edited by Baily, 27 July 2007 - 01:47 PM.

  • 0

#2 iceflame1019

iceflame1019

    GMC Member

  • New Member
  • 846 posts

Posted 26 July 2007 - 03:31 PM

I tried this once and it worked pretty well. Make an object (for now named obj_moveto) that the character moves to. Then in the object event under Global Mouse event.
x=mouse.x
y=mouse.y

Next, use the drag'n'drop feature Move to Point ::lmao:: , under the Object tab up top select the character, then in the x and y coordinates type in obj_moveto.x and obj_moveto.y. Should work if I'm remembering correctly. Make the obj_moveto persistant. Or, in the room creation code,
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.

  • 0

#3 Baily

Baily

    GMC Member

  • New Member
  • 218 posts

Posted 26 July 2007 - 08:44 PM

Can you make a simple example? Kind of speaking greece to me.
  • 0

#4 iceflame1019

iceflame1019

    GMC Member

  • New Member
  • 846 posts

Posted 26 July 2007 - 08:53 PM

Yeah but it'll hafta wait til about 8 when I get home and have dinner. I can probably give a D&D walkthrough here:

Create obj_moveto. In the Events tab, find Global Mouse Left :).
Now:
::lmao:: -- Set x to mouse.x and y to mouse.y

Now, add this icon:
:o -- See the bars up at the top of the new screen? Change the one that says "Self" and select the middle bar (I think it's the middle; it allows you to select an object you've already made), and from there select the character object.

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.

  • 0

#5 Baily

Baily

    GMC Member

  • New Member
  • 218 posts

Posted 27 July 2007 - 12:03 AM

Ty for making an example. Even when I put the DrD version it doesn't work.The ball (player) just sits there. :blink: You can just make a simple example with like two sprites/objects.
  • 0

#6 chokobo

chokobo

    GMC Member

  • GMC Member
  • 20 posts

Posted 27 July 2007 - 06:59 AM

Try this... its very simple so dont get scared

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=0

Ok 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.

  • 0

#7 Baily

Baily

    GMC Member

  • New Member
  • 218 posts

Posted 27 July 2007 - 01:41 PM

Oooooh, ty :blink: Working now.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users