Jump To Position Code?
#1
Posted 22 July 2007 - 08:36 PM
Ive tried 'position_change' and 'instance_position' but they dont seem to work.
Thanks
#2
Posted 22 July 2007 - 08:43 PM
x=50
y=50
For jumping to a random position put:
x=random(room_width)
y=random(room_height)
#3
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)
How would i choose what object is to use that code?
#4
Posted 22 July 2007 - 09:00 PM
#5
Posted 22 July 2007 - 09:06 PM
{
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
#6
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.
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.
#7
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
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
#8
Posted 22 July 2007 - 10:08 PM
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..
#9
Posted 22 July 2007 - 10:15 PM
error in code at line 2
track = !track
at position 2: symbol , or ) expected.
#10
Posted 22 July 2007 - 10:21 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) //needed a ) right here...
track = !track
#11
Posted 22 July 2007 - 11:03 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











