Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New PongClone Demo
#1
I've tried to bring to life a my old application made with the oldest version of Inform.
But I have had no success, so I decided to make a new version... for not wasting my time I'm using InformPe in Windows11.
So I got no surprise!

It is a simple demo (not playable) of the classical Pong game. The ancient Pong!

Here you can get the source files distribution in 7zip file:

.7z   NewPongClone.7z (Size: 125.88 KB / Downloads: 5)
and here a .ZIP made under Kubuntu with its application Ark.

.zip   NewPongClone.zip (Size: 149.03 KB / Downloads: 5)

and here a Screenshot



[Image: immagine-2026-02-08-024146896.png]

To get the application :
1 download the file
2 unpack the 7zip in your QB64pe folder
3 go in the NewPongClone folder
4 open NewPongClone.bas with QB64peIDE 
5 compile hitting F5 or clicking on the Run menu

It is a demo for showing how using basic features of InformPE:
how to set colors (Background, Foreground, BorderColor) of items of application,
how to use disable items,
how to make animation with items, 
how to use an image in Button item,
how to use the Frame item,
how to implement User routines in main module,
how to declare Global variable in main module
how to change on fly the properties of items of InformPE.

Welcome feedbacks

Lucky TempodiBasic

PS: I have followed the rule put informpe included files and folders into the folder of application to compile for distributing it.
Reply
#2
One prompt to google and i got this so why would i use inform?
Up/Down arrows and space serves
Code: (Select All)
' NEON-PONG ULTIMATE - QB64 Edition
' Controls: UP/DOWN Arrows to move, SPACE to serve
' Features: Particle FX, Screen Shake, Adaptive AI, Neon Glow

$RESIZE:ON
SCREEN _NEWIMAGE(800, 600, 32)
_TITLE "NEON-PONG: THE ULTIMATE QB64 CLONE"
RANDOMIZE TIMER

' --- Constants & Variables ---
CONST P_WIDTH = 15, P_HEIGHT = 90
CONST BALL_SIZE = 10, MAX_PARTICLES = 100
TYPE Particle
  x AS SINGLE: y AS SINGLE
  xv AS SINGLE: yv AS SINGLE
  life AS SINGLE: active AS INTEGER
END TYPE

DIM SHARED p1y, p2y, bx, by, bxv, byv, p1s, p2s, serving, shake
DIM SHARED parts(MAX_PARTICLES) AS Particle
p1y = 250: p2y = 250: serving = 1: p1s = 0: p2s = 0

' --- Main Game Loop ---
DO
  _LIMIT 60 ' Smooth 60 FPS
  CLS

  ' Draw Background & UI
  LINE (400, 0)-(400, 600), _RGB32(50, 50, 80) ' Center Line
  COLOR _RGB32(0, 255, 255): LOCATE 2, 20: PRINT USING "PLAYER: ##"; p1s
  COLOR _RGB32(255, 0, 255): LOCATE 2, 60: PRINT USING "CPU: ##"; p2s

  ' Handle Input
  IF _KEYDOWN(18432) THEN p1y = p1y - 8 ' Up Arrow
  IF _KEYDOWN(20480) THEN p1y = p1y + 8 ' Down Arrow
  IF p1y < 0 THEN p1y = 0 ELSE IF p1y > 510 THEN p1y = 510

  ' Serving Mechanic
  IF serving THEN
    bx = 40: by = p1y + 45
    IF _KEYDOWN(32) THEN ' Space to serve
      serving = 0: bxv = 7: byv = (RND * 10) - 5
      SOUND 800, 0.5 ' High pitch serve
    END IF
  ELSE
    UpdateBall
    UpdateCPU
  END IF

  ' Update Visuals
  UpdateParticles
  DrawGame

  _DISPLAY
LOOP UNTIL _KEYDOWN(27) ' ESC to exit

SUB UpdateBall
  bx = bx + bxv: by = by + byv

  ' Top/Bottom Bounce
  IF by < 0 OR by > 590 THEN
    byv = -byv: shake = 5
    SOUND 400, 0.2
    CreateBurst bx, by, 5
  END IF

  ' Paddle Collisions (Neon Logic)
  IF bx < 30 AND by > p1y AND by < p1y + P_HEIGHT THEN
    bxv = -bxv * 1.05: bx = 31: CreateBurst bx, by, 10
    byv = (by - (p1y + 45)) * 0.2 ' Deflection angle
    SOUND 600, 0.3
  END IF

  IF bx > 760 AND by > p2y AND by < p2y + P_HEIGHT THEN
    bxv = -bxv * 1.05: bx = 759: CreateBurst bx, by, 10
    byv = (by - (p2y + 45)) * 0.2
    SOUND 600, 0.3
  END IF

  ' Scoring
  IF bx < 0 THEN p2s = p2s + 1: serving = 1: CreateBurst 400, 300, 30
  IF bx > 800 THEN p1s = p1s + 1: serving = 1: CreateBurst 400, 300, 30
END SUB

SUB UpdateCPU
  ' Adaptive AI: Follows ball with a bit of "lag" for fairness
  IF by > p2y + 45 THEN p2y = p2y + 6
  IF by < p2y + 45 THEN p2y = p2y - 6
  IF p2y < 0 THEN p2y = 0 ELSE IF p2y > 510 THEN p2y = 510
END SUB

SUB CreateBurst (x, y, num)
  FOR i = 1 TO MAX_PARTICLES
    IF parts(i).active = 0 AND num > 0 THEN
      parts(i).active = 1: parts(i).x = x: parts(i).y = y
      parts(i).xv = (RND * 10) - 5: parts(i).yv = (RND * 10) - 5
      parts(i).life = 255: num = num - 1
    END IF
  NEXT
END SUB

SUB UpdateParticles
  FOR i = 1 TO MAX_PARTICLES
    IF parts(i).active THEN
      parts(i).x = parts(i).x + parts(i).xv
      parts(i).y = parts(i).y + parts(i).yv
      parts(i).life = parts(i).life - 10
      IF parts(i).life <= 0 THEN parts(i).active = 0
      CIRCLE (parts(i).x, parts(i).y), 2, _RGB32(255, 255, 0, parts(i).life)
    END IF
  NEXT
END SUB

SUB DrawGame
  ' Screen Shake Effect
  DIM ox, oy: IF shake > 0 THEN ox = (RND * 10) - 5: oy = (RND * 10) - 5: shake = shake - 1

  ' Neon Paddles (using LINE with BF for solid boxes)
  LINE (15 + ox, p1y + oy)-(15 + P_WIDTH + ox, p1y + P_HEIGHT + oy), _RGB32(0, 255, 255), BF
  LINE (770 + ox, p2y + oy)-(770 + P_WIDTH + ox, p2y + P_HEIGHT + oy), _RGB32(255, 0, 255), BF

  ' Neon Ball (Circle with color)
  CIRCLE (bx + ox, by + oy), BALL_SIZE, _RGB32(255, 255, 255)
  PAINT (bx + ox, by + oy), _RGB32(255, 255, 255)
END SUB

Unseen
Reply
#3
(02-08-2026, 07:03 AM)Unseen Machine Wrote: One prompt to google and i got this so why would i use inform?
Up/Down arrows and space serves
Code: (Select All)
' NEON-PONG ULTIMATE - QB64 Edition
' Controls: UP/DOWN Arrows to move, SPACE to serve
' Features: Particle FX, Screen Shake, Adaptive AI, Neon Glow

$RESIZE:ON
SCREEN _NEWIMAGE(800, 600, 32)
_TITLE "NEON-PONG: THE ULTIMATE QB64 CLONE"
RANDOMIZE TIMER

' --- Constants & Variables ---
CONST P_WIDTH = 15, P_HEIGHT = 90
CONST BALL_SIZE = 10, MAX_PARTICLES = 100
TYPE Particle
  x AS SINGLE: y AS SINGLE
  xv AS SINGLE: yv AS SINGLE
  life AS SINGLE: active AS INTEGER
END TYPE

DIM SHARED p1y, p2y, bx, by, bxv, byv, p1s, p2s, serving, shake
DIM SHARED parts(MAX_PARTICLES) AS Particle
p1y = 250: p2y = 250: serving = 1: p1s = 0: p2s = 0

' --- Main Game Loop ---
DO
  _LIMIT 60 ' Smooth 60 FPS
  CLS

  ' Draw Background & UI
  LINE (400, 0)-(400, 600), _RGB32(50, 50, 80) ' Center Line
  COLOR _RGB32(0, 255, 255): LOCATE 2, 20: PRINT USING "PLAYER: ##"; p1s
  COLOR _RGB32(255, 0, 255): LOCATE 2, 60: PRINT USING "CPU: ##"; p2s

  ' Handle Input
  IF _KEYDOWN(18432) THEN p1y = p1y - 8 ' Up Arrow
  IF _KEYDOWN(20480) THEN p1y = p1y + 8 ' Down Arrow
  IF p1y < 0 THEN p1y = 0 ELSE IF p1y > 510 THEN p1y = 510

  ' Serving Mechanic
  IF serving THEN
    bx = 40: by = p1y + 45
    IF _KEYDOWN(32) THEN ' Space to serve
      serving = 0: bxv = 7: byv = (RND * 10) - 5
      SOUND 800, 0.5 ' High pitch serve
    END IF
  ELSE
    UpdateBall
    UpdateCPU
  END IF

  ' Update Visuals
  UpdateParticles
  DrawGame

  _DISPLAY
LOOP UNTIL _KEYDOWN(27) ' ESC to exit

SUB UpdateBall
  bx = bx + bxv: by = by + byv

  ' Top/Bottom Bounce
  IF by < 0 OR by > 590 THEN
    byv = -byv: shake = 5
    SOUND 400, 0.2
    CreateBurst bx, by, 5
  END IF

  ' Paddle Collisions (Neon Logic)
  IF bx < 30 AND by > p1y AND by < p1y + P_HEIGHT THEN
    bxv = -bxv * 1.05: bx = 31: CreateBurst bx, by, 10
    byv = (by - (p1y + 45)) * 0.2 ' Deflection angle
    SOUND 600, 0.3
  END IF

  IF bx > 760 AND by > p2y AND by < p2y + P_HEIGHT THEN
    bxv = -bxv * 1.05: bx = 759: CreateBurst bx, by, 10
    byv = (by - (p2y + 45)) * 0.2
    SOUND 600, 0.3
  END IF

  ' Scoring
  IF bx < 0 THEN p2s = p2s + 1: serving = 1: CreateBurst 400, 300, 30
  IF bx > 800 THEN p1s = p1s + 1: serving = 1: CreateBurst 400, 300, 30
END SUB

SUB UpdateCPU
  ' Adaptive AI: Follows ball with a bit of "lag" for fairness
  IF by > p2y + 45 THEN p2y = p2y + 6
  IF by < p2y + 45 THEN p2y = p2y - 6
  IF p2y < 0 THEN p2y = 0 ELSE IF p2y > 510 THEN p2y = 510
END SUB

SUB CreateBurst (x, y, num)
  FOR i = 1 TO MAX_PARTICLES
    IF parts(i).active = 0 AND num > 0 THEN
      parts(i).active = 1: parts(i).x = x: parts(i).y = y
      parts(i).xv = (RND * 10) - 5: parts(i).yv = (RND * 10) - 5
      parts(i).life = 255: num = num - 1
    END IF
  NEXT
END SUB

SUB UpdateParticles
  FOR i = 1 TO MAX_PARTICLES
    IF parts(i).active THEN
      parts(i).x = parts(i).x + parts(i).xv
      parts(i).y = parts(i).y + parts(i).yv
      parts(i).life = parts(i).life - 10
      IF parts(i).life <= 0 THEN parts(i).active = 0
      CIRCLE (parts(i).x, parts(i).y), 2, _RGB32(255, 255, 0, parts(i).life)
    END IF
  NEXT
END SUB

SUB DrawGame
  ' Screen Shake Effect
  DIM ox, oy: IF shake > 0 THEN ox = (RND * 10) - 5: oy = (RND * 10) - 5: shake = shake - 1

  ' Neon Paddles (using LINE with BF for solid boxes)
  LINE (15 + ox, p1y + oy)-(15 + P_WIDTH + ox, p1y + P_HEIGHT + oy), _RGB32(0, 255, 255), BF
  LINE (770 + ox, p2y + oy)-(770 + P_WIDTH + ox, p2y + P_HEIGHT + oy), _RGB32(255, 0, 255), BF

  ' Neon Ball (Circle with color)
  CIRCLE (bx + ox, by + oy), BALL_SIZE, _RGB32(255, 255, 255)
  PAINT (bx + ox, by + oy), _RGB32(255, 255, 255)
END SUB

Unseen

Reread: It is a demo for showing how using basic features of InformPE
Reply
#4
Why make a GAME with a GUI!? Especially one you cant play!

Like till it does this      to me its just a toolkit that got hyped up! You, Pete, me and many others have made it defunct in my view! (and im well aware my opinion means nothing to you guys).

Unseen
Reply
#5
@TempodiBasic
Could you make an additional compressed file as .zip?
For some reason or other my system will not allow me to download a .7z
Computers!
Reply
#6
@Maghda
updated the #1 with a Zip file made after downloading the .7z in Kubuntu
Reply
#7
Here in Kubuntu 
1. the Unseen & IA code has freezed the laptop. I have to reset it!
LOL. After a boot rescue I was able to run the executable file.
(Lucky TempodiBasic!)

2. my  not game Demo in Informpe gives a different output!
(Lucky TempodiBasic)
take a look to this screenshot!


[Image: Screenshot-20260208-152137.png]
Reply
#8
(02-08-2026, 08:59 AM)Unseen Machine Wrote: Why make a GAME with a GUI!? Especially one you cant play!
Because we (interested parties) can have a look and learn from the coding techniques used.  This is what we do all the time on this forum.

@TempodiBasic thanks.
Reply
#9
+1 AI for the nice added touch!
Code: (Select All)
Sub CreateBurst (x, y, num)
    For i = 1 To MAX_PARTICLES
        If parts(i).active = 0 And num > 0 Then
            parts(i).active = 1: parts(i).x = x: parts(i).y = y
            parts(i).xv = (Rnd * 10) - 5: parts(i).yv = (Rnd * 10) - 5
            parts(i).life = 255: num = num - 1
        End If
    Next
End Sub


As long as we are wasting time here is Infinite Pong - The Movie!
Code: (Select All)
_Title "Infinite Pong the Movie.bas for QB64 B+ 2018-09-16"
p1y = 1: p2y = 25 'paddle y
bx = 30: by = 10: bdx = 2: bdy = 1 'ball x, y, dx, dy
While 1
    Cls
    For row = 2 To 24
        Locate row, 5: Print "|";
        Locate row, 75: Print "|";
    Next
    p1x = bx - 5: _PrintString (p1x, p1y), "1111111111" ' draw paddle 1
    p2x = bx - 5: _PrintString (p2x, p2y), "2222222222" ' draw paddle 2
    If bx + bdx < 6 Then bdx = bdx * -1 + Int(Rnd * 3) - 1
    If bx + bdx > 74 Then bdx = bdx * -1 + Int(Rnd * 3) - 1
    If by + bdy < 2 Then bdy = bdy * -1: bdx = bdx + Int(Rnd * 3) - 1
    If by + bdy > 24 Then bdy = bdy * -1: bdx = bdx + Int(Rnd * 3) - 1
    bx = bx + bdx: by = by + bdy
    _PrintString (bx, by), "O"
    _Limit 10
Wend

Sorry you cant play this one either bLOL
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#10
@Bplus
Hi Mark I see that you made a gift for Pete with this ASCII_Pong_Demo


[Image: Screenshot-20260211-130531.png]



@Unseen
Hi John
I know how you are a clever coder. 
Surely at your eyes InformPE (the current GUI RAD available for QB64PE) has its limits, but everything has its limits...
see the work of your AI... when the ball gets the left or right edge and it explodes... the particles of the explosion are locate at the middle vertical line. Can you suggest to the AI  to make before explosion with particles and then initialize again the ball position?
Exiting from the joke, NewPongClone by InformPE is a demo about how to manage items and code in .BAS  made by InformPE.  After drawing the GUI you must fill it with projected behaviors to avoid a void shell.

However let read this to AI as solution of the bug


[Image: Screenshot-20260208-174507.png]
Lucky TempodiBasic
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)