Quick Views and Backgrounds question

W

Wild_West

Guest
2 quick questions,
1.What's a way to animate a background, like, say waves going up and down as they scroll?
I tried using background_vspeed but I could only get it to move once of course because I set it in the room creation.
I don't know what commands to go with if I do a controller object for any one room's backgrounds.

2.How do you manipulate a view when it's following an object, and then reset it to that object?
I played around with a screen shake but couldn't get it to center back on my player.
I used some of the usual view built-in stuff, but couldn't find any tutorials on how reset it for a followed object.
 

jo-thijs

Member
No way to really animate a background.
I think though that you will be happy already by using timelines in combination with background_hspeed and background_vspeed.

As for the views, when following an object, they're updated after the end step event, so there's no totally convenient way.
I would recommend to just manually make the view follow the object in the end step event.
However, there is a draw event in which you can update view_xview and view_yview after the view updated to follow the object.
It was either the pre draw event or the begin draw event.
You can implement your shake code there, but I don't really recommend it.
 
W

Wild_West

Guest
No way to really animate a background.
I think though that you will be happy already by using timelines in combination with background_hspeed and background_vspeed.

As for the views, when following an object, they're updated after the end step event, so there's no totally convenient way.
I would recommend to just manually make the view follow the object in the end step event.
However, there is a draw event in which you can update view_xview and view_yview after the view updated to follow the object.
It was either the pre draw event or the begin draw event.
You can implement your shake code there, but I don't really recommend it.
Okay well the screen shake was an optional thing I just wanted to test anyway, but I wasn't sure about the background.
I've seen stuff on timeines but never used them since I as still just starting out and trying to perfect my enemies.
Now's a good time to start practicing with them I guess since my enemies are done for the most part.
Thanks for the info
 

TheouAegis

Member
Reset view to a followed object:
view_object = id

Replace id with the id of the object you want the view to follow. If you set the view_hspeed and view_vspeed to -1, it will snap directly to the object.

Or

view_xview = x - view_wview / 2;
view_yview = y - view_yview / 2;


As for the moving background, you can use multiple backgrounds and change the background_index associated with them. I wouldn't bother with a timeline, just make your own variable or use an alarm. You'll need a controller object anyway.

alarm[0] = 8;
background_vspeed = 1/2;

alarm[0] event:
background_vspeed *= -1;
alarm[0] = 8;
 
Top