increasing the size of spikes
objScaleFree
Create Event:
// this object will scale up or down when triggered
// you can specify the origin to use when scaling (see below)
// tarx, tary can be negative number, too.
//
// in the creation code, put:
// trg : trigger number
// tarx : target xscale
// tary : target yscale
// origin : as below
// there are 2 ways of triggering
//
// scaling speed triggering :
// xsp : xscale speed
// ysp : yscale speed
//
// scaling time triggering :
// time : the time to scale to target scale
//
// origins :
//
// 1 2 3
// 4 5 6
// 7 8 9
//
width = sprite_get_width(sprite_index);
height = sprite_get_height(sprite_index);
xoff = sprite_get_xoffset(sprite_index);
yoff = sprite_get_yoffset(sprite_index);
depth = 1000002;
Step Event
if (global.triggered==trg) {
if tarx!=0{
if(time == 0){
if tarx*(image_xscale-(tarx-xsp))<0{
image_xscale+=xsp;
x -= (((origin - 1) mod 3)/2*width-xoff)*xsp;
}
else{
image_xscale=tarx;
//given that the starting image_xscale = 1
x = xstart - (((origin-1) mod 3)/2*width-xoff)*(tarx-1);
}
}
else{
if tarx*(image_xscale-tarx)<0{
image_xscale+=(tarx-1)/time;
x -= (((origin - 1) mod 3)/2*width-xoff)*(tarx-1)/time;
}
}
}
if tary!=0{
if(time == 0){
if tary*(image_yscale-(tary-ysp))<0{
image_yscale+=ysp;
y -= (((origin - 1) div 3)/2*height-yoff)*ysp;
}
else{
image_yscale=tary;
//given that the starting image_yscale = 1
y = ystart - (((origin-1) div 3)/2*height-yoff)*(tary-1);
}
}
else{
if tary*(image_yscale-tary)<0{
image_yscale+=(tary-1)/time;
y -= (((origin - 1) div 3)/2*height-yoff)*(tary-1)/time;
}
}
}
}
Example:
(put in creation code on the object in the room)
sprite_index=sprSpikeUp
tarx=2;
tary=2;
time=15;
trg=1;
origin=8;
making spikes move and stop at specific positions
objPathFree
Create Event:
// this object will move along a path when triggered
// in the creation code , put:
//
// sprite_index : sprite
// trg : trigger number
// pth : path index
// spd : moving speed
// move : whether the object will continue moving if player died (prevent spoilers)
// enda : endaction
// scl : path scale (for ex. if you need to move path 3 blocks, to not create another path type scl=3;
//
// endactions :
// 0 : stop the path
// 1: continue from the start position (if the path is not closed we jump to the start position)
// 2: continue from the current position
// 3: reverse the path, that is change the sign of the speed
depth = 1000002;
Step Event:
if (global.triggered==trg && !flag) {
path_start(pth,spd,enda,0);
if scl!=0{
path_scale = scl;
}
flag=1;
}
End Step:
// if player dies during when the spike is still moving
// it continue moving along the previous direction
// you can choose to disable this by deleting this event
if(!instance_exists(player) && path_speed!=0 && (!path_ended)){
if(move){
speed = path_speed;
path_end();
move = false;
}
}
End of Path:
path_ended = 1;
Example:
pth=pD1; // you need to create pathes yourself and tick off the box called "Closed"
spd=4;
trg=2;
sprite_index=sprSpike;
thanks based Nikaple.