• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Constanly Scrolling View

S

SmallyBiggs

Guest
I'm experimenting with views, and I'm wondering if its possible to have a constantly vertically scrolling view that the player must outrun. (Or more specifically, "out climb" using platforms). I haven't been able to find any info on this subject, so any ideas or links to more info are greatly appreciated!
 
J

jackhigh24

Guest
you keep the view still and move the backgrounds and everything else past the player, that way you can keep a tiny room that looks like its goes on forever.
 

jo-thijs

Member
Don't let the view follow any object and use this code in a step event:
Code:
view_yview[0] -= 1;
and let the player object execute this in its end step event:
Code:
if bbox_top >= view_yview[0] + view_hview[0]
    // kill the player here, because he fell to low
 
S

SmallyBiggs

Guest
Don't let the view follow any object and use this code in a step event:
Code:
view_yview[0] -= 1;
and let the player object execute this in its end step event:
Code:
if bbox_top >= view_yview[0] + view_hview[0]
    // kill the player here, because he fell to low
New Ah this seems to make sense. Thank You! However I'd like to know, what does the variable "bbox_top refer to?
 

jo-thijs

Member
You're welcome!

bbox_top is the y coordinate of the topmost pixel colliding with the non-precise hitbox of the executing instance.

If your object doesn't have a mask and you let GameMaker automatically take care of hitboxes for sprites
and you use the default (no) draw event for your object and then change then put this code in the draw event:
Code:
draw_self();
draw_set_colour(c_red);
draw_set_alpha(1);
draw_rectangle(bbox_left, bbox_top, bbox_right + 1, bbox_bottom + 1, true);
then you should see a red rectangle that surrounds the instance's sprite perfectly (maybe 1 pixel off, because of the thickness of the rectangle).
This maintains its effect when playing around with image_xscale, image_yscale and image_angle.
 
Top