Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411722 Posts in 69402 Topics- by 58450 Members - Latest Member: FezzikTheGiant

May 22, 2024, 03:14:10 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Parallax/Tiles question [SOLVED]
Pages: [1]
Print
Author Topic: Parallax/Tiles question [SOLVED]  (Read 4219 times)
Kevin
Guest
« on: April 08, 2010, 01:08:01 PM »

Is it possible, in game maker, to incorporate a parallax effect into a tile layer? Right now, the back/foregrounds I want to scroll are made up of tiles, and rather than converting everything to objects or background images, I'd rather just manipulate the existing tile layers directly. tile_layer_shift doesn't seem to do it, and I can't find anything else that looks like it might do the trick.

If this has been asked before, or has an obvious solution, just redirect and/or chastise me, and I'll continue not asking questions. Also, if it make no sense at all, let me know so I can clarify.
« Last Edit: April 09, 2010, 10:13:16 AM by Kevin » Logged
Desert Dog
Level 4
****



View Profile
« Reply #1 on: April 08, 2010, 02:22:53 PM »

Yes you can. Yes tile_layer_shift should do it.

Could you perhaps show us your code you did? We'll poke that a bit and see if we can get it working.
Logged

Kevin
Guest
« Reply #2 on: April 08, 2010, 04:08:05 PM »

Okay, I have it working, sort of, using the following:

tile_layer_shift(-2,0+(-ob_player.hspeed/4),0)

This makes the tile layer scroll at an acceptable speed while the player is moving and, mostly, does what I want. The problem now is that I'd rather have it synced to the movement of the view. Right now, if the player's moving and the view isn't, the tiles still scroll (and it looks... wrong).

Is there a specific view function I should be using here?
Logged
Desert Dog
Level 4
****



View Profile
« Reply #3 on: April 08, 2010, 08:29:55 PM »

You should be able to just use view_hspeed in your code like this.

Code:
tile_layer_shift(-2,0+(view_hspeed[view_number]/4),0)
Logged

Kevin
Guest
« Reply #4 on: April 09, 2010, 10:08:32 AM »

Ha! Stupid me.

It worked fine the way I had it before, I just had to tell it to stop scrolling when view_xview was at point 0/when view_hspeed was 0.

So, the final code looks like this:

Code:
if view_xview>0 &&view_hspeed !=0
{
tile_layer_shift(-2,0+(-ob_player.hspeed/4),0);
}

Thanks so much for the help, Desert Dog.
Logged
Desert Dog
Level 4
****



View Profile
« Reply #5 on: April 09, 2010, 02:30:42 PM »

No problem. Smiley
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic