• 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!

Need help with coding a Breakout game

B

blitz2600

Guest
I'm making a breakout clone, but I like to make it a mouse game. I can't seem to find any code that would make the paddle go from left to right or up and down. I did, how ever, find some code that made the paddle follow my mouse around the screen, but that's not want I wanted.
Can anyone please help me out and give me the code for my paddle to move left and right and up and down.
Thanks :D
 

obscene

Member
So you want to use the mouse to move the paddles but you dont want the paddles to follow the mouse?

You need to explain exactly what you want to happen and share the code you already have or else you're just asking "Code this myserious thing for me."
 
B

blitz2600

Guest
the code I found, the paddle followed the mouse all over the screen. Up, Down, Left and Right.
In some lvls, I just want the paddle to move left or right and in other lvls I like it to move up or down. Not following the mouse where ever I move it.
 
I

InfantRegalia

Guest
Just restrict the code to only follow the mouse.x while keeping it's own y coordinate.
 
I

InfantRegalia

Guest
I'm a noob at this. How would u do that? Could you write it out for me?
Post the code for making the paddle follow your mouse. There is a million ways to write this type of code. So I need something you already work with.
 
B

blitz2600

Guest
Here is the code I found.
move_towards_point(mouse_x, mouse_y, point_direction(x,y, mouse_x, mouse_y))
Like I said it does follow the mouse around, but it's kind of erratic. I was hopping to get code the would follow my mouse nice and smooth. Not bouncing around all over the place.
Thanks
 
I

InfantRegalia

Guest
that's a pretty jiggly way of doing it. just put something like this into your paddle's step event

if point_distance(x, y, mouse_x, 20) > 5
{
move_towards_point(mouse_x, 20, 5);
}
else speed = 0;

p.s. i'm a complete newb myself, but you really should read the website, and watch some tutorials. lacking basic understanding will get you nowhere :( it's much more fun to try and learn!
 
B

blitz2600

Guest
that's a pretty jiggly way of doing it. just put something like this into your paddle's step event

if point_distance(x, y, mouse_x, 20) > 5
{
move_towards_point(mouse_x, 20, 5);
}
else speed = 0;

p.s. i'm a complete newb myself, but you really should read the website, and watch some tutorials. lacking basic understanding will get you nowhere :( it's much more fun to try and learn!
Thank you.
I'd have been watching some videos about it. Right now I'm watching some tutorials and learning how to make some game. At this point the GML is a little confusing, but I'm trying to learn it. That's why I've posted this thread. To get a little help.
 
Top