• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android breakout/arkanoid question

U

Uberpink

Guest
anybody can recommend a simple tutorial? i made a level, and the bat and ball... i made the ball get more motion to the sides the more the ball hit bat close to the sides, so not just a simple bounce... seem to work.

problem is if i swipe the bat too fast ofcourse the ball appear inside the bat and that cause problems with ball direction..... to try to solve it i did something to the bat when ball collides.... when ball collides with bat i make the bat non collideable for some steps while the ball is going up again before collision is turned on again,,, it helps abit infact but still get some weirdness if moving bat fast and ball suddenly trapped in bat...... sometimes i managed to give the ball a direction completely going left or right which makes it unplayable

any simpe ideas?

in the --bat object-- i have a collision check with the ball... heres the code:

if telle>3 // ball will collide with bat if "telle is bigger than 3..... ("telle" increases each step in the step event)
{

if balla.x<x-5 then balla.direction-=4; // bat is about 40 pixels long..these 8 lines tells ball to have more motion to the sides depending on where ball hit bat. may be lamercode.. was the first that came to my mind:)
if balla.x<x-10 then balla.direction-=6;
if balla.x<x-15 then balla.direction-=8;
if balla.x<x-20 then balla.direction-=10;


if balla.x>x+5 then balla.direction+=4;
if balla.x>x+10 then balla.direction+=6;
if balla.x>x+15 then balla.direction+=8;
if balla.x>x+20 then balla.direction+=10;

with balla move_bounce_all(other) // then just bounce ball together with additional direction info above ,which works well
telle=0
}

i got an impression that no matter how u code it, the ball might always be able to end up inside bat and cause issues,, so im completely stucked lol..... it could work with a fixed speed on bat and no finger movement but that might be very frustrating. additional info,, bat got precice collision with rounded edges.. ball got square collision ... not sure if very relevant , and maybe precise collision isnt even needed, im even thinking of having a bat without rounded corners to make it easier for the collision if possible.... maybe even the simple bounce command on bat isnt needed but could be done more failsafe with additional direction code instead....
 
Last edited by a moderator:
Top