Moving a path with the view
Forum » The Community / Game Maker Help » Moving a path with the view
started by: shwhjwshwhjw
on: 1258733034|%e %b %Y, %H:%M %Z|agohover
number of posts: 5
rss icon RSS: new posts
summary:
Is there a way to move a path along with a view?
Moving a path with the view
shwhjwshwhjw 1258733034|%e %b %Y, %H:%M %Z|agohover

Hi,

I'm working on a project which uses a view, which moves from the bottom of the room to the top.

It needs to have an object follow a path, left to right across the view. The path is working, however because the view is moving up, it causes the object to appear to shift downwards, instead of staying at the view's vertical position.

I've tried moving the object itself up every frame (both with 'jump to position' and 'set vertical speed'), which has no effect. Not sure what else to try.

Is there any way to move the path with the view? I'm using GM Pro.

Thanks,
Simon.

unfold Moving a path with the view by shwhjwshwhjw, 1258733034|%e %b %Y, %H:%M %Z|agohover
Re: Moving a path with the view
shwhjwshwhjw 1258734287|%e %b %Y, %H:%M %Z|agohover

I realise I could edit the path points to compensate, but the path has circles, and it'll take forever to get it right. Just looking for an easier way!

unfold Re: Moving a path with the view by shwhjwshwhjw, 1258734287|%e %b %Y, %H:%M %Z|agohover
Re: Moving a path with the view
mr glassesmr glasses 1258740367|%e %b %Y, %H:%M %Z|agohover

try checking the the game maker manuel (that comes with game maker)

unfold Re: Moving a path with the view by mr glassesmr glasses, 1258740367|%e %b %Y, %H:%M %Z|agohover
Re: Moving a path with the view
shwhjwshwhjw 1258743622|%e %b %Y, %H:%M %Z|agohover

Thanks, found a method called path_shift() that is supposed to move the path, but I have no idea of the syntax, and can't seem to find anywhere that explains it. Can anyone help?

unfold Re: Moving a path with the view by shwhjwshwhjw, 1258743622|%e %b %Y, %H:%M %Z|agohover
Re: Moving a path with the view
shwhjwshwhjw 1258747299|%e %b %Y, %H:%M %Z|agohover

Hoo-bleedin-rah: got it!
Just gonna explain quickly in case anyone else needs this, as it was a nightmare to find any help on.

Paths cannot be moved while there is an instance following them.

After assigning path(in Create event):
CREATE EVENT

//create variable for old position
pos = path_position
//take object off path
path_end();
//move path to view
path_shift(path0, 0, view_yview)
//put object back on path, absolute = true
path_start(path0,1,0,true);
//move along path a bit
path_position = pos + 0.004;

STEP EVENT

pos = path_position
path_end();
//move path with view (in this case, y -1)
path_shift(path0, 0, -1)
//put object back on path
path_start(path0,1,0,true);
//move a bit
path_position = pos + 0.004;

Hope this helps other people. gawd knows i struggled with it.

last edited on 1258747320|%e %b %Y, %H:%M %Z|agohover by shwhjw + show more
unfold Re: Moving a path with the view by shwhjwshwhjw, 1258747299|%e %b %Y, %H:%M %Z|agohover
new post