top of page
Search

[5] Pong Release [4/4]

  • Writer: Conlan Walker
    Conlan Walker
  • Oct 21, 2021
  • 2 min read

Updated: Oct 22, 2021

On Monday, I at first just wanted a quick solution to finishing the Pong game so that I could just as quickly start something else. I changed my mind at the thought of having a possibly quarter-baked finished product, with basically no progress on a separate thing. Due to this, I thought it'd be better if I just added features in a steady manner throughout the week, and have something not abjectly embarrassing to show for it.

Here's a list of the things I had in mind on adding at the beginning of the week:

  1. Differently-pitched sounds based on hit strength

  2. Size of particles change depending on hit strength

  3. Add applicable music

  4. Particles generate at point-of-contact with paddle

  5. Have a tiled, looping background that moves in a random direction when game starts

  6. Reintegrate touch controls

  7. Port over anything above that player 1 has, that player 2 currently doesn't

This video demonstrates the different sounds that play based on where the ball hits:

I added a visual aid with the cyan line thing by angling and stretching a sprite in a certain way,

and it shows what image point the ball is closest to.

You can also see the exact sound that is to play for each collision (boink0 -> 4) in the bottom-left corner of the screen.


This one shows the addition of music, as well as the size of the emitted particles changing proportional to the strength of a hit.

Furthermore, It shows how the logic of idea #4 works, as shown by the number in the lower-left corner (though as of that video, the feature wasn't finished yet).

To check which side of the paddle the ball hits, I had to basically make a line using two image points of the paddle, and see which side of that line the ball rests on.

The equations that determine this is basically:

p=position of ball,

a=position of bar image point 0,

b=position of bar image point 4

n=(p_x−a_x)(b_y−a_y)−(p_y−a_y)(b_x−a_x)

side= n/abs(n)

The sign of "side" can then be used for the check (-1,1).


This next one shows the tiled looping background, which is supposed to be 256x256 in size for each, or else it starts looping improperly:

For the demo, the score was replaced with how fast the background moves every tick.

The following image shows how the background's scrolling speed is defined:

ree

I used some Earthbound battle background, because most of them were made to be looped.

I could replace it with any other 256x256 image if there's any problems, though.


Finally, the video below shows the current state of the game, with an attempt at showing the touch controls that I implemented last minute as I was writing this:


And that's about it.

Honestly, I enjoyed this week a lot more, as I got over most of the annoying hurdles that I ran into last week, and I didn't come across many new ones while working, either.


The game can be found here if interested:

 
 
 

Comments


bottom of page