Jump to content


Photo

Jump To Position Code?


  • Please log in to reply
10 replies to this topic

#1 JAMzLU3

JAMzLU3

    GMC Member

  • GMC Member
  • 119 posts

Posted 22 July 2007 - 08:36 PM

Does anyone know the code for the 'jump to given position' action?
Ive tried 'position_change' and 'instance_position' but they dont seem to work.

Thanks
  • 0

#2 Stubbjax

Stubbjax

    RandomGuy General

  • GMC Member
  • 4113 posts
  • Version:GM6

Posted 22 July 2007 - 08:43 PM

For jumping to a certain position put:

x=50
y=50

For jumping to a random position put:

x=random(room_width)
y=random(room_height)
  • 0

#3 JAMzLU3

JAMzLU3

    GMC Member

  • GMC Member
  • 119 posts

Posted 22 July 2007 - 08:55 PM

For jumping to a certain position put:

x=50
y=50

For jumping to a random position put:

x=random(room_width)
y=random(room_height)

<{POST_SNAPBACK}>


How would i choose what object is to use that code?
  • 0

#4 burnt effigy

burnt effigy

    GMC Member

  • New Member
  • 173 posts

Posted 22 July 2007 - 09:00 PM

just put the code in an event for the object. the event can vary depending on what you want to trigger the jumping to the position.
  • 0

#5 String

String

    GMC Member

  • New Member
  • 250 posts

Posted 22 July 2007 - 09:06 PM

with( object )
{
x = random( room_width )
y = random( room_height )
}

with( object )
{
x = <the x you specify>
y = <the y you specify>
}

The first one is to make it jump to a random position.
The second one is to make it jump to a specified position..
Object can either be an id, an object name, self, all, or noone.

Enjoy :D
  • 0

#6 JAMzLU3

JAMzLU3

    GMC Member

  • GMC Member
  • 119 posts

Posted 22 July 2007 - 09:30 PM

just put the code in an event for the object.  the event can vary depending on what you want to trigger the jumping to the position.

<{POST_SNAPBACK}>


Well i have an object moving on a path and the when the player presses space while touching that object the view changes to it and the player is deactivated.
When i press space again it activates the player and changes the view back to it.

Im trying to make it like the player has moved with the object and then been dropped off at a point but when i activate the player its back were it was before.

So i need it to make the player follow the object probably.
  • 0

#7 JAMzLU3

JAMzLU3

    GMC Member

  • GMC Member
  • 119 posts

Posted 22 July 2007 - 10:00 PM

with( object )
{
x = random( room_width )
y = random( room_height )
}

with( object )
{
x = <the x you specify>
y = <the y you specify>
}

The first one is to make it jump to a random position.
The second one is to make it jump to a specified position..
Object can either be an id, an object name, self, all, or noone.

Enjoy  :D

<{POST_SNAPBACK}>



Ok thanks, works well.
I used:

with(obj_player)
{
x=obj_move.x;
y=obj_move.y;
}

but the only problem now is how do i disconnect obj_player from obj_move when i press space? cause the two objects are locked now.

Getting there tho.

Thanks
  • 0

#8 String

String

    GMC Member

  • New Member
  • 250 posts

Posted 22 July 2007 - 10:08 PM

Create event of player:

track = true

Step event:

if track = true
{
x = <that thing that it is following>.x
y = <that thing that it is following>.y
}

Press Space Event:
if place_meeting( x, y, <that thing that it is following>
track = !track

Should work..
  • 0

#9 JAMzLU3

JAMzLU3

    GMC Member

  • GMC Member
  • 119 posts

Posted 22 July 2007 - 10:15 PM

says:

error in code at line 2

track = !track

at position 2: symbol , or ) expected.
  • 0

#10 ghkdudgk

ghkdudgk

    GMC Member

  • GMC Member
  • 111 posts
  • Version:Unknown

Posted 22 July 2007 - 10:21 PM

he just made an error in the code

Create event of player:

track = true

Step event:

if track = true
{
x = <that thing that it is following>.x
y = <that thing that it is following>.y
}

Press Space Event:
if place_meeting( x, y) //needed a ) right here...
track = !track

  • 0

#11 JAMzLU3

JAMzLU3

    GMC Member

  • GMC Member
  • 119 posts

Posted 22 July 2007 - 11:03 PM

ah i still cant get this to work. No error message just that i cant get the player to deattach off the moving object when i press space.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users