Hi!
Jeddakya here
Re: GM2
i'm not following no tutorial (i'm a total non-conformist). dreaming this up as i go. just for the fun of it.
move_bounce_all - move and bounce obj off any n all objects
move_bounce_solid - move and bounce obj off solid objects only
move_contact_solid - move obj until obj hits a solid object; stops dead.
in my ball's
step event is one line.
move_contact_solid(direction, global.ballspeed)
my wall's
"ball collision" event (because walls effect the ball) is also one line:
with(other) move_bounce_solid(true);
i've added a line to the wall's
"ball collision" event to output a line of text "ball hit wall" (not draw_text, but i create a "message" object that displays the output). this message will sometimes display up to four times when the ball hits the wall! but not consitently. sometimes "ball hit wall" appears once, twice, three times, or even not at all (and no, it's not the msg object's fault)! the ball bounces, for sure. but will appear to "stick" to the wall for a frame or three (likely the same number of frames as the number of times the msg "ball hit wall" appears) and then continues its expected movement. it's an utterly baffling issue. all objects are set to solid. there are six objects: four "walls", a "paddle" and a ball. i'm not doing bricks until this "sticking" issue goes away.
strangely, this is not happening when the paddle and ball collide. well, it did, but for a different reason. the paddle is now coded differently. its movement is attached to the mouse, which required some thinking to get the ball to stop sticking to the paddle. turns out, i was allowing the mouse movement to move the paddle into the ball's position (overlapping the two) by just setting paddle's X to mouse_x lol. so, instead, i move the paddle one pixel at a time toward the mouse's X position (checking for ball collisions along the way) per step, bounce the ball away (if collision, of course), and continue moving until the paddle reaches mouse_x. convoluted, but it solved that problem. but...walls don't move! so ... i'm kinda stuck, if you'll pardon the pun.
i've tried many things to prevent this "stickyness", but to no avail.
after the
move_contact_solid(direction, global.ballspeed)
line in the ball's step event, i've added things like
move_bounce_solid(true)
and removed
move_bounce_solid(true)
from the wall's
"ball collision" event. that worked, too! but, the ball still sticks to walls for a frame or three. even tried using
move_outside_solid(direction-180,global.ballspeed)
, but that didn't seem to make a lick of a difference! i've even tried using the
step end event! did
if (x == xprevious and y == yprevious)
and output'd another message "ball is stuck". that message will appear lots!
i've removed bouncing all together, to allow the ball to just stop when it hits a solid object. the ball goes inside the wall! <blink><blink><blink>
i think i have a fundamental knowledge gap. if i draw a box around the ball from another object's draw event, the box appears to be a frame behind or ahead - i can't tell. it's the correct size though
so i'm at a loss. no idea how to fix this, let alone diagnose the issue.
any ideas or help would be most appreciated