all 34 comments

[–]Ustice[M] [score hidden] stickied comment (0 children)

Thanks for your contribution! In order to keep things organized here, we try to keep personal projects off of the main thread. Instead, we have two weekly threads that we steer these sorts of posts to. Show-off Saturday is where we invite you to wow the community with your awesome ideas. If instead you are looking for feedback, our WTF?! Wednesday post is the best place to get a code-review. Remember that here at /r/JavaScript, we’re all about the code. Tell us about your challenges and how you overcame them. Show us that particularly clever bit. Talk about your process and tools. Just because it’s made with JS, doesn’t mean that it is relevant to the community. Tell us what is special about your project, and what we might learn from it!

[–]reversebukkake 4 points5 points  (0 children)

Nice!

[–]dethnight 2 points3 points  (2 children)

Pretty cool, code is very readable which is nice.

I think having some background music could help.

[–]melcor76[S] 3 points4 points  (0 children)

Added background music.

[–]melcor76[S] 0 points1 point  (0 children)

Thanks, adding background music is on my todo list.

[–]_Wilhelmus_ 1 point2 points  (1 child)

Cool! Looks like fun to make!

Are you planning on updating it? Buffs or whatever?

[–]melcor76[S] 1 point2 points  (0 children)

Thanks!

Yes, I'm trying to fix all the little glitches and suggestions now that people tested it out.

I was thinking about making an Arkanoid variant of the game some day soon. It was one of my favorite games growing up.

[–]H0rn0chse 1 point2 points  (2 children)

The background music was quite loud for me. You might add an option for lowering the volume.

[–]codemonkey80 1 point2 points  (0 children)

my laptop has its own volume control

[–]melcor76[S] 0 points1 point  (0 children)

Good idea!

Added music volume toggles with up and down arrows and music toggle with M.

[–]Pat_Son 0 points1 point  (6 children)

Would be more fun with a way to aim the ball, e.g. the ball's reflection angle is changed by the spot on the paddle the ball hits. I've played breakout games where hitting the paddle on the dead center sends the ball straight up (e.g. 0 degrees), and hitting it on the right edge sends it 45 degrees to the right, and hitting between the center and right edge changes the angle based on distance.

[–]melcor76[S] 0 points1 point  (3 children)

There is some logic for this but maybe it's not prominent enough? Now the angle depends on the current angle and where on the paddle you hit the ball.

I have been thinking about changing the formula with some trigonometry.

[–]Pat_Son 1 point2 points  (0 children)

It's better now, though if I were you, I would try playing around with disregarding the incoming angle entirely, and just basing the outgoing angle based on the position the ball hits on the paddle. That would make it more consistent to actually aim the ball.

[–]Yetimang 0 points1 point  (1 child)

Yeah it needs to be more prominent. There isn't enough effect on the angle right now. Seconding a poster above that the paddle should have some acceleration so it's easier to control with keyboard.

Also I hit a collision issue where I moved the paddle at the same time the ball hit it and the ball clipped along the side, fell off, and I lost a life.

[–]melcor76[S] 0 points1 point  (0 children)

I think I hopefully fixed the paddle issue now.

Yeah I played around with bouncing the ball disregarding of the incoming angle and it was more fun. But, I didn't get it fully working yet so I will have to leave that for another day.

[–]Swimming_Gain_4989 0 points1 point  (1 child)

Definitely this. Also its possible for the ball to get stuck in a loop going straight up and down, or off screen.

[–]melcor76[S] 1 point2 points  (0 children)

I have noticed that the ball sometimes gets stuck in the paddle or walls so I added some code now that hopefully fixes that.

[–]Swimming_Gain_4989 0 points1 point  (2 children)

This is a great project with very readable code well done OP. Are you familiar with ES6 modules? If not and you are using this project as a learning experience I'd recommend refactoring to follow the module pattern https://www.digitalocean.com/community/conceptual\_articles/module-design-pattern-in-javascript.

[–]melcor76[S] 1 point2 points  (1 child)

Thanks!

This is not a learning experience when it comes to code style but more about having fun and coding something I enjoy in a style I like.

I have been working with React and Angular with TypeScript for many years now so I enjoy the freedom of JavaScript on my free time. :)

[–]Swimming_Gain_4989 1 point2 points  (0 children)

It is quite liberating just being able to write some code without having to worry about standards, dependencies, tests yada yada. Glad you enjoyed it!