gamemaker parallax background




Information about object: obj_player
Sprite: spr_player
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

Step Event:
execute code:

///player movement code
flying_level=200;
moving=false;
if (keyboard_check(ord('W')))
{
y-=5;
moving=true;

}
if (keyboard_check(ord('S')))
{
y+=5;
moving=true;

}

if moving=false && y<flying_level// move back to center
{
y+=2;
y=y+((flying_level-y)*0.01);


}

if moving=false && y>flying_level // move back to center
{
y-=2;
y=y-((y-flying_level)*0.01);


}

global.difference=(flying_level-y)/10;//set as a global value as it will be used for parallax background
image_angle=global.difference-10;
//keep in screen
if y<20 y=20;
if y>380 y=380;

execute code:

///parallax global.difference global.difference
background_y[1] = view_yview[0]+global.difference*0.5-100;
background_y[2] = view_yview[0]+global.difference*1-75;
background_y[3] = view_yview[0]+global.difference*2-75;

No comments:

Renowned Water Expert Reynold Aquino Offers Exclusive Water Softener Discounts

Los Angeles, California - November 21, 2024 - World-renowned water expert Reynold Aquino is excited to announce exclusive discounts on prem...

Contact Form

Name

Email *

Message *