Alright, I've edited it a little bit, so it looks like this now:
//This script calculates where the player will land and makes a block
//scrGenMakeBlock(objectCreate, objectAvoid, minBlocks, maxBlocks, pillarSize, checkForPlayer?)
//Variable setup
var wallobject,spr,ox,w,oy,h,dy,tx,ty,pmask,pxscl,pyscl,pang,t,inoxo,inoyo,inoxw,inoyw;
wallobject=argument0;
spr=object_get_sprite(wallobject);
ox=sprite_get_xoffset(spr);
w=sprite_get_width(spr);
oy=sprite_get_yoffset(spr);
h=sprite_get_height(spr);
//Create the block
for (ii = argument2; ii <= argument3; ii += 1)
{
//calculate position of block
dy=oy+h*ii+(sprite_get_height(mask_index)-sprite_get_yoffset(mask_index))*image_yscale;
dy=round((y+dy)/h)*h-y;
t=sqr(gravity*.5+vspeed)+2*gravity*dy;
if t<0
{
continue;
}
tx=((sqrt(t)-vspeed)/gravity-.5)*hspeed
+x+((sprite_get_width(mask_index)>>1)-sprite_get_xoffset(mask_index))*image_xscale+ox-(w>>1);
ty=y+dy;
tx=round((tx)/w)*w;
//Save the player variables
pmask=mask_index;
mask_index=spr;
pxscl=image_xscale;
image_xscale=1;
pyscl=image_yscale;
image_yscale=1;
pang=image_angle;
image_angle=0;
//Create the block
//check for objectAvoid, and if too close
if (!place_meeting(tx, ty, argument1))
{
//create all the blocks in the pillar
for (ii = 0; ii < argument4; ii += 1)
{
//check if each individual block is not overlapping objectAvoid
if (!place_meeting(tx, ty +(ii*32), argument1))
{
//create the block
t = instance_create(tx, ty +(ii*32), wallobject);
//destroy if player is there
if (argument5)
with (t)
if place_meeting(x,y,other)
{
instance_destroy();
with (other)
continue;
}
}
}
//end
break;
}
}
//reset plater sprites
mask_index=pmask;
image_xscale=pxscl;
image_yscale=pyscl;
image_angle=pang;
So Now I should just be able to set minBlocks to -5, and maxBlocks to 5, and then it should find the highest block that the player will land on. Though it often creates the block, so the player hits it from the side. Is there a way to make it, so it will find the highest block that the player can land on?



Find content
Male
