gamemaker spawner

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

Step Event:
execute code:

if(mouse_check_button_pressed(mb_left))
{
  var _inst=instance_create(x,y,obj_spawned);
  _inst.target_x=mouse_x;
  _inst.target_y=mouse_y;
}

Information about object: obj_spawned
Sprite: Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask:
No Physics Object
Create Event:
execute code:

///Properties
timer=0;
z=0;
start_x=obj_spawner.x;
start_y=obj_spawner.y;
target_x=noone;
target_y=noone;
length=room_speed/2;

shadow_alpha=0;
shadow_alpha_min=.25;
shadow_alpha_max=.5;
shadow_scale=1;
shadow_scale_min=.5;
shadow_scale_max=1;
Step Event:
execute code:

if(timer<length)
  timer++;
else
  timer=length;

x=lerp(start_x,target_x,timer/length);
y=lerp(start_y,target_y,timer/length);
z=arc(0,32,0,timer/length,.8);

shadow_alpha=lerp(shadow_alpha_max,shadow_alpha_min,z/32);
shadow_scale=lerp(shadow_scale_max,shadow_scale_min,z/32);
/*
shadow_alpha=0;
shadow_alpha_min=.25;
shadow_alpha_max=.5;
shadow_scale=1;
shadow_scale_min=.5;
shadow_scale_max=1;
Draw Event:
execute code:

///draw self
depth=-y;
draw_sprite_ext(spr_shadow,0,x,y,shadow_scale,shadow_scale,0,c_white,.5);
draw_sprite(spr_thing,0,x,y-z);


///arc(start[0], peak[1], floor[2], position[3], bias[4])
if(argument[3]<=.5)
    return(lerp(argument[0],argument[1],bias(argument[4],argument[3]*2)));
else
{
    var b=1-argument[4];
    var p=2*argument[3]-1
    return(lerp(argument[1],argument[2],bias(b,p)));
}

bias(b,t)
{
    return argument1/((1/argument0-2)*(1-argument1)+1);
}

No comments:

Top 3 UX Design Articles of 2024 to Remember

Based on most subscriptions ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­...

Contact Form

Name

Email *

Message *