Page 1 of 1

My game

PostPosted: Sat Feb 07, 2015 2:54 pm
by Naughty
I seen another thread like this, go i guess ill post mine AND DONT EXPECT IT TO BE AWESOME, its my first game test of pong

Im learning C# and JS to make games within unity3d and im starting to learn some flash development aswell.

My main knowledge currently resides within website development so its not too different when it comes to learning


My first game: Pong. Lol.

left player: UP: A / DOWN: S

right player: UP: up key / DOWN: down key

I made it two player because i dont know how to make an system to play back, but i also tried to do this as fast as i could


http://www.kongregate.com/games/Derpzen/2-player-pong

Re: My game

PostPosted: Sat Feb 07, 2015 3:14 pm
by Lycanblade
terribly boring, with no objective, but i guess i shouldnt expect much from a test

i like the color scheme and the fact that it's on kong tho XD
and it's very smooth and simple(took me 10 min to fugure out how to play :lol: )

Re: My game

PostPosted: Sat Feb 07, 2015 3:44 pm
by Stabber

Forgive me if this won't work for your game (I don't have the unity plugin installed on my computer)

Here is how you could make an AI:

difficulty: easy = 0, normal = 1, hard = 2, impossible = 999

computerY: y position of the center of the paddle (may be different for your program)
ballY: y position of the center of the ball
ball_radius: radius of the ball

Code: Select all
Each game tick:
// move paddle towards the ball vertically.  Higher difficulties move faster
if (computerY > ballY) {
    computerY = max(computerY - ballY, computerY - 2 * difficulty - 3);
} else if (computerY < ballY) {
    computerY = min(ballY - computerY, computerY + 2 * difficulty + 3);
}



If the angle the ball ricochets of the paddle changes based on paddle position (again, I haven't installed the plugin to play your game, so sorry if none of this applies), you can do more complicated stuff:

if ball is heading towards the computer player (check X velocity to see if this is true):

have computer calculate where the y-position of the ball will be when the ball is close enough to be hit by the computer's paddle.

Calculate the desired Y position of the ball that the player has to hit (which location on the player's side will be hardest for the player to defend? This could depend on the current position of the player's paddle, and the maximum speed at which the player's paddle can move up/down).
Calculate the necessary x/y velocity of the ball to go from predicted y-position at the computer's side to the desired y-position at the player's side.

From this x/y velocity, figure out the angle (use arctan) that the ball will have to bounce off at when the computer's paddle hits it.

Use this angle to find the necessary y-position of the paddle.
Use the movement code above (replace ballY with necessary Y position) to have the paddle move there.


Re: My game

PostPosted: Sat Feb 07, 2015 8:52 pm
by itblobboy
Talk about classy, this guy over here remade pong for education!

Re: My game

PostPosted: Sat Feb 07, 2015 9:14 pm
by koalasium
Apparently I need unity web player, which I don't and won't have. Is there some other way to play it?

Re: My game

PostPosted: Sat Feb 07, 2015 10:30 pm
by Lu-Bu
koalasium wrote:Apparently I need unity web player, which I don't and won't have. Is there some other way to play it?

wait you need unity? probably means its a 3D game and i cannot play those games due to me not having a
"3D graphic card" or some shiz.

Re: My game

PostPosted: Tue Feb 10, 2015 7:27 am
by StormNinja
Stabber is here to show off his badass skills once again.

Re: My game

PostPosted: Tue Feb 10, 2015 12:44 pm
by Naughty
StormNinja wrote:Stabber is here to show off his badass skills once again.


Hey i give stabber props he knows what he is talking about, he even helped me with some of the code via my blog making it more efficient. Stabber, ever thought about going into making games yourself?

We could try to come up with some helmet heroes related mini games for people here to play and if you arent that good with photoshop i got that covered