Questions tagged [pong]

Pong (marketed as PONG) is one of the earliest arcade video games. Pong is seen today as the "Hello World" to 2d game development.

Pong (marketed as PONG) is one of the earliest arcade video games; it is a tennis sports game featuring simple two-dimensional graphics. While other arcade video games came before it, Pong was one of the first video games to reach mainstream popularity. The aim is to defeat the opponent in a simulated table tennis game by earning a higher score.

476 questions
26
votes
7 answers

Pong: How does the paddle know where the ball will hit?

After implementing Pacman and Snake I'm implementing the next very very classic game: Pong. The implementation is really simple, but I just have one little problem remaining. When one of the paddle (I'm not sure if it is called paddle) is controlled…
anon
24
votes
4 answers

How to implement Ping/Pong request for webSocket connection alive in javascript?

I use websocket in javascript. But the connection close after one minute. I am wondering somethings: 1- Is not Websocket naturaly providing with Ping/Pong messages not to close the connection? I think it have to. Otherwise what is the difference…
Qwer Sense
  • 487
  • 1
  • 5
  • 12
7
votes
1 answer

How Do I Use KeyEventDispatcher

I have been trying to make a Pong clone as sort of a beginner's project, and I've hit a road block. I have managed to get to the point of keyboard support, but the keyboard repeat delay kicks in. I haven't found any usable way to use…
Cg2916
  • 1,117
  • 6
  • 23
  • 36
7
votes
4 answers

Where does the context live in an OOP Javascript Pong game?

To practice my OOP knowledge I'm making a Pong game in javascript (I know, I know, it's like playing Stairway to Heaven in a guitar shop). I've had several functioning versions of the game by implementing several different techniques including…
punkrockbuddyholly
  • 9,675
  • 7
  • 36
  • 69
7
votes
2 answers

Unity - how to use Vector2.Reflect()

I have looked everywhere including the Unity documentation but cannot seem to find any good examples of how to use Unity's Vector2.Reflect() function. I am trying to use this to control the direction of the ball (in a 2D Breakout game) when it hits…
Kaz
  • 137
  • 2
  • 3
  • 17
6
votes
1 answer

Swift Pong(No SpriteKit): How to calculate ball angles to move ball

I'm trying to make the game Pong using Swift, but without using SpriteKit. So far, I have been able to successfully draw a rectangle on my view, and I am able to drag this around the screen. This is my current code: import UIKit class PongView:…
Xcoder
  • 1,433
  • 3
  • 17
  • 37
5
votes
2 answers

How to fix inconsistent frame rate (speed) in python turtle

I a made pong game by following this tutorial https://youtu.be/C6jJg9Zan7w The problem I'm having is that speed of the ball (turtle object) is not the same on different computers. For example, on the tutorial instructor's computer the value of…
Saadat
  • 163
  • 4
  • 15
5
votes
2 answers

Pong Paddle collision velocity and rebound angle

Well I've searched a lot for this but all I can find is people saying like do pi * direction, direction being the angle that the ball is coming in at I assume. But my problem is, I have no idea how I get the angle the ball is coming in at in the…
user1763295
  • 860
  • 3
  • 16
  • 34
5
votes
2 answers

Java pong game Graphics or geom 2D

My first project is to make the game Pong in Java. Because I need to calculate the delta for my x position and y position, I think the best way is to use double variables(excuse me if i'm wrong). But you can't use a double for fill a shape in the…
Jordi
  • 61
  • 3
4
votes
1 answer

Problem with slowing down ball in pong game

I've been making pong with pygame and I got the ball to bounce around the screen and on the paddles. However, the speed is too high and I want to decrease it. This is what the code looks like for the Ball object: import pygame as pg BLACK = (0, 0,…
simo.
  • 69
  • 5
4
votes
3 answers

Making a pong game in assembly, how do I get an input of multiple keystrokes at once?

I'm a beginner so this code probably isn't any good, I used int 16h for this but I don't know a lot about this int. I just found out you can't have multiple keystrokes at once; any help? The problem with this code is that only one board can move at…
orraz1
  • 43
  • 5
4
votes
6 answers

How do you make computer lose in a pong game?

So me and my partner are trying to make a pong game that's player vs. computer, but we just couldn't figure out how to make the computer lose. We already have the basic stuff done and it works fine but the computer just never loses. And we also…
Angela
  • 41
  • 2
4
votes
1 answer

Trying to get ball to return to middle after ball has left screen

I'm trying to recreate a game of pong just for fun. Here is my full code as of right now. import pygame, random, math pygame.init() #colours:------------------------------------------------------------- R = random.randrange(1,255) B =…
4
votes
2 answers

Player positions server side or client side?

I just made a multiplayer browser implementation of the game Pong using socket.io and have a question regarding logistics of real time. Basically the player's paddle is just a colored-in div that moves up or down depending on which button they're…
MarksCode
  • 8,074
  • 15
  • 64
  • 133
4
votes
2 answers

javax Websocket handle ping messages

I have a websocket server deployed on Glassfish 4. I try to use ping/pong. My plan is to send periodically pings from the server to the clients and if they do not pong back I wan to close the conenction. Unfortunately there seem not do be any…
ThommyH
  • 310
  • 2
  • 6
  • 15
1
2 3
31 32