You are not logged in.
Pages: 1
I made a script (I also submitted it to GMLscripts.com):
/*
** Usage:
** draw_background_depth_layer(background,x,y,ratio,view);
**
** Arguments:
** background Background to draw, background.
** x X coordinate where (background_center_x = view_center_x), real.
** y Y coordinate where (background_center_y = view_center_y), real.
** ratio Movement ratio of the background, real.
** view Number of the view to use, real.
**
** Notes:
** The background's center is always drawn at (x,y) when the center of the view is (x,y).
**
** Ratio notes:
** (if ratio < 0): strange reversed movement, not very useful.
** (if ratio = 0): background follows view.
** (if 0 < ratio < 1): slow-moving background.
** (if ratio = 1): static background.
** (if ratio > 1): fast-moving background.
**
** GMLscripts.com
*/
{
var r,bx,by,bw,bh,dx,dy,vx,vy,vw,vh;
r = 1-argument3;
bw = background_get_width(argument0);
bh = background_get_height(argument0);
dx = argument1;
dy = argument2;
vw = view_wview[argument4];
vh = view_hview[argument4];
vx = view_xview[argument4]-dx;
vy = view_yview[argument4]-dy;
bx = ((vx+vw/2)*r)-bw/2+dx;
by = ((vy+vh/2)*r)-bh/2+dy;
draw_background(argument0,bx,by);
}
Last edited by Jimmynator (2011-03-31 11:46:25)
Offline
Welcome to the GMLscripts.com forums! This is a really great idea for a script. Thanks for the submission.
Abusing forum power since 1986.
Offline
Are you going to put this code online?
It can ba also done with sprites, and it's really fast.
Note: if you are going to post it you should change the name, it's too long.
Offline
Pages: 1