#Moving Boxes
1187 messages · Page 2 of 2 (latest)
floor should be fine
i need to go to sleep
ok
i doesnt floor anything
that's not the goal
yeah that's fine
well
it fixed the jump teleport
gotcha
aight
gnight
thanks again
cya tomorrow maybe
next you will need to make a draw_event
yeah
draw_sprite_ext(sprite_index,image_index,x,floor(y),x_facing,image_yscale,0,c_white,1)
thats what I have
floor(x) as well now
kk
oh?
visually that is
yeah
oBox is using movement() now?
@barren yew, hey, mind helping once more?
pretty please with a cherry on top?
trying to push multiple block at once?
not just
the x keeps moving and isnt stuck at 0
if I try to push or pull a block to where it shouldnt be
yeah
that shouldn't be
x is clearly changing
whats the problem in the video, you try to push and it fails cause there is another block
yeah
function Movement()
{
var grounded = place_meeting(x,floor(y)+1,oCollision)
var tolerance = 1 + ceil(abs(x_speed));
if place_meeting(x+x_speed,floor(y),oCollision)
{
var slope = false
if (grounded)
{
for (var i = 1; i <= tolerance; i++)
{
if (!place_meeting(x + x_speed, floor(y) - i, oCollision))
{
slope = true;
y -= i;
break;
}
}
}
if !slope
{
if abs(x_speed) > 1
{
while !place_meeting(x+sign(x_speed),floor(y),oCollision)
x += sign(x_speed)
}
x_speed = 0
}
}
else
{
if (grounded)
{
for (var i = 0; i <= tolerance; i++)
{
if (place_meeting(x + x_speed, floor(y) + i + 1, oCollision))
{
y += i;
break;
}
}
}
}
x += x_speed
if place_meeting(x,floor(y+y_speed),oCollision)
{
while !place_meeting(x,y+sign(y_speed),oCollision)
{
y += sign(y_speed)
}
y_speed = 0
}
y += y_speed
}```
thats Movement()
lemme see
perhaps draw_sprite_ext just like player draw sprite
im flooring both x and y
and now it still pushing into the other box
but by a full pixel
round
perhaps round the player too
ah yeah
they're opporating on different basis
yeah
they should both be floor, but you're moving it by 0.2 pixel, then drawing it, then setting to normal position when you stop
yeeah
also
yeah
function Movement()
{
var grounded = place_meeting(x,floor(y)+1,oCollision)
var tolerance = 1 + ceil(abs(x_speed));
if place_meeting(floor(x+x_speed),floor(y),oCollision)
{
var slope = false
if (grounded)
{
for (var i = 1; i <= tolerance; i++)
{
if (!place_meeting(floor(x + x_speed), floor(y) - i, oCollision))
{
slope = true;
y -= i;
break;
}
}
}
if !slope
{
if abs(x_speed) > 1
{
while !place_meeting(x+sign(x_speed),floor(y),oCollision)
x += sign(x_speed)
}
x_speed = 0
}
}
else
{
if (grounded)
{
for (var i = 0; i <= tolerance; i++)
{
if (place_meeting(floor(x + x_speed), floor(y) + i + 1, oCollision))
{
y += i;
break;
}
}
}
}
x += x_speed
if place_meeting(floor(x),floor(y+y_speed),oCollision)
{
while !place_meeting(floor(x),y+sign(y_speed),oCollision)
{
y += sign(y_speed)
}
y_speed = 0
}
y += y_speed
}```
did I miss any?
i dont understand the
if (place_meeting(floor(x + x_speed), floor(y) + i + 1, oCollision))
{
y += i;
break;
}
why is x_speed being check for y movement
ok
slopes dont work now
yup
your first place_meeting is not floored
its important
for slopes
you're not gonna get the same result sometimes
ALL
your place meeting need to be on the up and up
this is non negotiable
yeah
changed it
ok so I removed the round() from the draw of the player
not jittering any more
remove or changed to floor?
removed
but it also made me stick into walls
idk why
becuase its just drawing her different
that's irrelevant
i think i know why
i can't help you there,
everything needs to be floor or round or ceiled
and i see lots of places everytime you post your code where its not
telling you how it is, you can't do place_meeting with fractions
then why not do -frac?
if your character is 2, and 1 is a collision, if character move to 1.8, is that allowed?
that's what floor does
1.9 floor = 1
1.9 - fract(1.9) is slower then just doing floor(1.9)
does it reallymatter?
it could, i dont know
then ill do frac
gonna make your code look like a mess
on that?
like i said
you built you system not ignoring fractions from the staart, then you asked for my help
and i said you can't do fractions
on collision check
this never happend before
cause you might still have tons of things that don't ignore fraction and some that do
so that valus don't match
its all fractions now