PingPong game

Post your working scripts, libraries and tools for AHK v1.1 and older
euras
Posts: 429
Joined: 05 Nov 2015, 12:56

PingPong game

10 Mar 2018, 13:54

Hi, sharing my created PingPong game based only on AHK.

Code: Select all

#SingleInstance, force
SetControlDelay, -1
SetBatchLines, -1 ; for delay precision
Process, Priority, , R ; high CPU cooperation (maxed at 50 on dual affinity, use H otherwise)
SendMode, Input ; no Send delay

DllCall("SystemParametersInfo", UInt, 0xB, UInt, 20, UIntP, 0, UInt, 0) ; 0xB is SPI_SETKEYBOARDSPEED. 31 is the max speed, 0 is the min.
DllCall("SystemParametersInfo", UInt, 0x17, UInt, 0, UIntP, 0, UInt, 0) ; 0x17 is SPI_SETKEYBOARDDELAY. the first 0 is the shortest delay 250ms, 3 is the highest 1 sec

gui, ping: new
gui, ping: Default
gui, color, Black
gui, font, cWhite s12 bold
Gui, Add, Button, ReadOnly x5 y5 h10 w100 0x10 vPC_Ping
Gui, Add, Button, ReadOnly x5 y485 h10 w100 0x10 vUser_Ping
Gui, Add, Button, ReadOnly x240 y240 h10 w10 0x10 vPong
GuiControl, ping: Hide, Pong

gui, font, cWhite s100 bold
gui, add, text, x200 y170 vT1, 3
gui, add, text, x200 y170 vT2, 2
gui, add, text, x200 y170 vT3, 1
gui, add, text, x130 y170 vT4, GO!

Loop, 4
	GuiControl, ping: Hide, T%A_Index%

gui, font, cBlack s8, Verdana
Gui, Add, StatusBar,
gui, show, w500 h520, PingPong

Hotkey, IfWinActive, PingPong
Hotkey, Right, PingPong_Right 
Hotkey, Left, PingPong_Left

Start_Game()
return

PingPong_Right:
GuiControlGet, User_Ping, ping:Pos
if (User_PingX <= 400)
	GuiControl, ping: Move, User_Ping, % "x" User_PingX+15
return

PingPong_Left:
GuiControlGet, User_Ping, ping:Pos
if (User_PingX >= 0)
	GuiControl, ping: Move, User_Ping, % "x" User_PingX-15
return

Pong_Moves:
if (First_Game = true)
{
	Loop
	{
		GuiControlGet, Pong, ping:Pos
		GuiControlGet, User_Ping, ping:Pos
		GuiControlGet, PC_Ping, ping:Pos
		
		User_Full_Ping_Start := User_PingX ; user ping width coordinates
		User_Full_Ping_End := User_PingX + 100
		User_Ping_Middle := User_PingX + 50
		
		if (PongY = 475 and (PongX >= User_Full_Ping_Start and PongX <= User_Full_Ping_End)){
			Side_to_Side_User()
			gosub, Pong_Moves_UP
			return
		}
		else if (PongY < 490){
			GuiControl, ping: Move, Pong, % "y" PongY+5
			sleep 25
		}
		if (PongY > 485){
			Your_Score += 0
			PC_Score += 10
			if (Your_Score = 100){
				MsgBox, You have won! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
			if (PC_Score = 100){
				MsgBox, You have lost! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
			SB_SetText("You have lost! Your score " . Your_Score . " vs PC score " . PC_Score)
			sleep 2000
			Start_Game()
			return
		}
		
	}
}

if (First_Game = false)
{
	Loop
	{
		GuiControlGet, Pong, ping:Pos
		GuiControlGet, User_Ping, ping:Pos
		GuiControlGet, PC_Ping, ping:Pos
		
		User_Full_Ping_Start := User_PingX ; user ping width coordinates
		User_Full_Ping_End := User_PingX + 100
		User_Ping_Middle := User_PingX + 50
		
		if (PongY = 475 and (PongX >= User_Full_Ping_Start and PongX <= User_Full_Ping_End)){
			Side_to_Side_User()
			gosub, Pong_Moves_UP
			return
		}
		else if (PongY < 490){
			If (rotation = "Left" and PongX > 0){
				GuiControl, ping: Move, Pong, % "x" PongX-Rand(4, 6) "y" PongY+5
				sleep 20
			}
			If (rotation = "Left" and PongX <= 0){
				rotation := "Right"
				GuiControl, ping: Move, Pong, % "x" PongX+Rand(4, 6) "y" PongY+5
				sleep 20
			}
			If (rotation = "Right" and PongX < 490){
				GuiControl, ping: Move, Pong, % "x" PongX+Rand(4, 6) "y" PongY+5
				sleep 20
			}
			If (rotation = "Right" and PongX >= 490){
				rotation := "Left"
				GuiControl, ping: Move, Pong, % "x" PongX-Rand(4, 6) "y" PongY+5
				sleep 20
			}

		}
		if (PongY > 485){
			Your_Score += 0
			PC_Score += 10
			if (Your_Score = 100){
				MsgBox, You have won! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
			if (PC_Score = 100){
				MsgBox, You have lost! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
			SB_SetText("You have lost! Your score " . Your_Score . " vs PC score " . PC_Score)
			sleep 2000
			Start_Game()
			return
		}
	}
}
return

Pong_Moves_UP:
First_Game := false
Loop
{
	GuiControlGet, Pong, ping:Pos
	GuiControlGet, User_Ping, ping:Pos
	GuiControlGet, PC_Ping, ping:Pos
	
	PC_Ping_Start := PC_PingX ; user ping width coordinates
	PC_Ping_Middle := PC_PingX + 50
	PC_Ping_End := PC_PingX + 100
	Pong_End := PongX + 10
	
	if (PongY = 15 and (PongX >= PC_Ping_Start and PongX <= PC_Ping_End)){
		Side_to_Side_PC()
		gosub, Pong_Moves
		return
	}
	
	if (PC_Ping_Middle < PongX){
		GuiControl, ping: Move, PC_Ping, % "x" PC_PingX+4
	}
	if (PC_Ping_Middle > Pong_End){
		GuiControl, ping: Move, PC_Ping, % "x" PC_PingX-4
	}
	
	if (PongY <= 485){
		If (rotation = "Left" and PongX > 0){
			GuiControl, ping: Move, Pong, % "x" PongX-Rand(4, 6) "y" PongY-5
			sleep 20
		}
		If (rotation = "Left" and PongX <= 0){
			rotation := "Right"
			GuiControl, ping: Move, Pong, % "x" PongX+Rand(4, 6) "y" PongY-5
			sleep 20
		}
		If (rotation = "Right" and PongX < 490){
			GuiControl, ping: Move, Pong, % "x" PongX+Rand(4, 6) "y" PongY-5
			sleep 20
		}
		If (rotation = "Right" and PongX >= 490){
			rotation := "Left"
			GuiControl, ping: Move, Pong, % "x" PongX-Rand(4, 6) "y" PongY-5
			sleep 20
		}
	}

	if (PongY < 10){
		Your_Score += 10
		PC_Score += 0
		if (Your_Score = 100){
				MsgBox, You have won! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
		if (PC_Score = 100){
				MsgBox, You have lost! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
		SB_SetText("PC have lost! Your score " . Your_Score . " vs PC score " . PC_Score)
		sleep 2000
		Start_Game()
		return
	}
}
return

Start_Game()
{
	global
	SB_SetText("")
	Loop, 4
	{
		sleep 100
		GuiControl, ping: Show, T%A_Index%
		sleep 900
		GuiControl, ping: Hide, T%A_Index%
	}
	GuiControl, ping: Move, Pong, % "x" 240 "y" 240
	GuiControl, ping: Show, Pong
	sleep 400
	First_Game := true
	gosub, Pong_Moves
}

Side_to_Side_User()
{
	global
	if (User_Ping_Middle > PongX)
		rotation := "Left"
	if (User_Ping_Middle < PongX)
		rotation := "Right"
	return, rotation
}

Side_to_Side_PC()
{
	global
	if (PC_Ping_Middle > PongX)
		rotation := "Left"
	if (PC_Ping_Middle < PongX)
		rotation := "Right"
	return, rotation
}

Rand( a=0.0, b=1 ) {
   IfEqual,a,,Random,,% r := b = 1 ? Rand(0,0xFFFFFFFF) : b
   Else Random,r,a,b
   Return r
}
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: PingPong game

10 Mar 2018, 14:32

Cool, impressive to make a game with so little code :clap:. Thanks for sharing :thumbup:.
Cheers
Spoiler
brutus_skywalker
Posts: 175
Joined: 24 Dec 2016, 13:16
Location: Antarctica

Re: PingPong game

10 Mar 2018, 14:51

F*$1N AWESOME!! :bravo:

AND WITH SUCH LITTLE CODE!!!DUDE!!!
Outsourcing Clicks & Presses Since 2004.
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: PingPong game

10 Mar 2018, 15:49

Very good game. Works great :bravo:
Helgef wrote:I changed the hotkeys to make the _____ a bit more responsive, and make the game easier 8-)
:shh: :arrow: bindMove() p_move() :ugeek: Amazing stuff !! :ugeek:


Thanks for sharing :wave:
euras
Posts: 429
Joined: 05 Nov 2015, 12:56

Re: PingPong game

10 Mar 2018, 17:30

Helgef wrote:Cool, impressive to make a game with so little code :clap:. Thanks for sharing :thumbup:.
aaayeah, that's I was looking for, now the game is complete, thanks Helgef! :)
User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: PingPong game

10 Mar 2018, 22:00

Very nicely done.

Here's a version with some sounds added. At least these exist and sound good on my version of Windows 10. Microsoft seems to change them all the time, so they might not exist or sound different on other systems, but it's easy enough to change the sound files near the top of the script.

Code: Select all

#SingleInstance, force
SetControlDelay, -1
SetBatchLines, -1 ; for delay precision
Process, Priority, , R ; high CPU cooperation (maxed at 50 on dual affinity, use H otherwise)
SendMode, Input ; no Send delay

PingSound := % A_WinDir "\media\Windows Pop-up Blocked.wav"
BonkSound := % A_WinDir "\media\Windows Information Bar.wav"
MissSound := A_WinDir "\media\Windows Default.wav"
WinSound := % A_WinDir "\media\tada.wav"
LoseSound := % A_WinDir "\media\Windows Hardware Fail.wav"

DllCall("SystemParametersInfo", UInt, 0xB, UInt, 20, UIntP, 0, UInt, 0) ; 0xB is SPI_SETKEYBOARDSPEED. 31 is the max speed, 0 is the min.
DllCall("SystemParametersInfo", UInt, 0x17, UInt, 0, UIntP, 0, UInt, 0) ; 0x17 is SPI_SETKEYBOARDDELAY. the first 0 is the shortest delay 250ms, 3 is the highest 1 sec

gui, ping: new
gui, ping: Default
gui, color, Black
gui, font, cWhite s12 bold
Gui, Add, Button, ReadOnly x5 y5 h10 w100 0x10 vPC_Ping
Gui, Add, Button, ReadOnly x5 y485 h10 w100 0x10 vUser_Ping
Gui, Add, Button, ReadOnly x240 y240 h10 w10 0x10 vPong
GuiControl, ping: Hide, Pong

gui, font, cWhite s100 bold
gui, add, text, x200 y170 vT1, 3
gui, add, text, x200 y170 vT2, 2
gui, add, text, x200 y170 vT3, 1
gui, add, text, x130 y170 vT4, GO!

Loop, 4
	GuiControl, ping: Hide, T%A_Index%

gui, font, cBlack s8, Verdana
Gui, Add, StatusBar,
gui, show, w500 h520, PingPong

Hotkey, IfWinActive, PingPong
rfnon := bindMove(2, 1)
rfnoff := bindMove(2, 0)
Hotkey, Right,  % rfnon
Hotkey, Right up,  % rfnoff
lfnon := bindMove(1, 1)
lfnoff := bindMove(1, 0)
Hotkey, Left, % lfnon
Hotkey, Left up, % lfnoff

Start_Game()
return
bindMove(dir, state){
	return func("p_move").bind(dir, state)
}
p_move(dir, state){
	settimer % dir == 1 ? "PingPong_Left" : "PingPong_Right", % state ? 25 : "off"
}

PingPong_Right:
GuiControlGet, User_Ping, ping:Pos
if (User_PingX <= 400)
	GuiControl, ping: Move, User_Ping, % "x" User_PingX+15
return

PingPong_Left:
GuiControlGet, User_Ping, ping:Pos
if (User_PingX >= 0)
	GuiControl, ping: Move, User_Ping, % "x" User_PingX-15
return

Pong_Moves:
if (First_Game = true)
{
	Loop
	{
		GuiControlGet, Pong, ping:Pos
		GuiControlGet, User_Ping, ping:Pos
		GuiControlGet, PC_Ping, ping:Pos
		
		User_Full_Ping_Start := User_PingX ; user ping width coordinates
		User_Full_Ping_End := User_PingX + 100
		User_Ping_Middle := User_PingX + 50
		
		if (PongY = 475 and (PongX >= User_Full_Ping_Start and PongX <= User_Full_Ping_End)){
			SoundPlay, %PingSound%
			Side_to_Side_User()
			gosub, Pong_Moves_UP
			return
		}
		else if (PongY < 490){
			GuiControl, ping: Move, Pong, % "y" PongY+5
			sleep 25
		}
		if (PongY > 485){
			SoundPlay, %MissSound%
			Your_Score += 0
			PC_Score += 10
			if (Your_Score = 100){
				SoundPlay, %WinSound%
				MsgBox, You have won! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
			if (PC_Score = 100){
				SoundPlay, %LoseSound%
				MsgBox, You have lost! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
			SB_SetText("You have lost! Your score " . Your_Score . " vs PC score " . PC_Score)
			sleep 2000
			Start_Game()
			return
		}
		
	}
}

if (First_Game = false)
{
	Loop
	{
		GuiControlGet, Pong, ping:Pos
		GuiControlGet, User_Ping, ping:Pos
		GuiControlGet, PC_Ping, ping:Pos
		
		User_Full_Ping_Start := User_PingX ; user ping width coordinates
		User_Full_Ping_End := User_PingX + 100
		User_Ping_Middle := User_PingX + 50
		
		if (PongY = 475 and (PongX >= User_Full_Ping_Start and PongX <= User_Full_Ping_End)){
			SoundPlay, %PingSound%
			Side_to_Side_User()
			gosub, Pong_Moves_UP
			return
		}
		else if (PongY < 490){
			If (rotation = "Left" and PongX > 0){
				GuiControl, ping: Move, Pong, % "x" PongX-Rand(4, 6) "y" PongY+5
				sleep 20
			}
			If (rotation = "Left" and PongX <= 0){
				rotation := "Right"
				SoundPlay, %BonkSound%
				GuiControl, ping: Move, Pong, % "x" PongX+Rand(4, 6) "y" PongY+5
				sleep 20
			}
			If (rotation = "Right" and PongX < 490){
				GuiControl, ping: Move, Pong, % "x" PongX+Rand(4, 6) "y" PongY+5
				sleep 20
			}
			If (rotation = "Right" and PongX >= 490){
				rotation := "Left"
				SoundPlay, %BonkSound%
				GuiControl, ping: Move, Pong, % "x" PongX-Rand(4, 6) "y" PongY+5
				sleep 20
			}

		}
		if (PongY > 485){
			SoundPlay, %MissSound%
			Your_Score += 0
			PC_Score += 10
			if (Your_Score = 100){
				SoundPlay, %WinSound%
				MsgBox, You have won! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
			if (PC_Score = 100){
				SoundPlay, %LoseSound%
				MsgBox, You have lost! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
			SB_SetText("You have lost! Your score " . Your_Score . " vs PC score " . PC_Score)
			sleep 2000
			Start_Game()
			return
		}
	}
}
return

Pong_Moves_UP:
First_Game := false
Loop
{
	GuiControlGet, Pong, ping:Pos
	GuiControlGet, User_Ping, ping:Pos
	GuiControlGet, PC_Ping, ping:Pos
	
	PC_Ping_Start := PC_PingX ; user ping width coordinates
	PC_Ping_Middle := PC_PingX + 50
	PC_Ping_End := PC_PingX + 100
	Pong_End := PongX + 10
	
	if (PongY = 15 and (PongX >= PC_Ping_Start and PongX <= PC_Ping_End)){
		SoundPlay, %PingSound%
		Side_to_Side_PC()
		gosub, Pong_Moves
		return
	}
	
	if (PC_Ping_Middle < PongX){
		GuiControl, ping: Move, PC_Ping, % "x" PC_PingX+4
	}
	if (PC_Ping_Middle > Pong_End){
		GuiControl, ping: Move, PC_Ping, % "x" PC_PingX-4
	}
	
	if (PongY <= 485){
		If (rotation = "Left" and PongX > 0){
			GuiControl, ping: Move, Pong, % "x" PongX-Rand(4, 6) "y" PongY-5
			sleep 20
		}
		If (rotation = "Left" and PongX <= 0){
			rotation := "Right"
			SoundPlay, %BonkSound%
			GuiControl, ping: Move, Pong, % "x" PongX+Rand(4, 6) "y" PongY-5
			sleep 20
		}
		If (rotation = "Right" and PongX < 490){
			GuiControl, ping: Move, Pong, % "x" PongX+Rand(4, 6) "y" PongY-5
			sleep 20
		}
		If (rotation = "Right" and PongX >= 490){
			rotation := "Left"
			SoundPlay, %BonkSound%
			GuiControl, ping: Move, Pong, % "x" PongX-Rand(4, 6) "y" PongY-5
			sleep 20
		}
	}

	if (PongY < 10){
		SoundPlay, %MissSound%
		Your_Score += 10
		PC_Score += 0
		if (Your_Score = 100){
				SoundPlay, %WinSound%
				MsgBox, You have won! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
		if (PC_Score = 100){
				SoundPlay, %LoseSound%
				MsgBox, You have lost! Your score is %Your_Score% vs PC score %PC_Score%
				return
			}
		SB_SetText("PC have lost! Your score " . Your_Score . " vs PC score " . PC_Score)
		sleep 2000
		Start_Game()
		return
	}
}
return

Start_Game()
{
	global
	SB_SetText("")
	Loop, 4
	{
		sleep 100
		GuiControl, ping: Show, T%A_Index%
		sleep 900
		GuiControl, ping: Hide, T%A_Index%
	}
	GuiControl, ping: Move, Pong, % "x" 240 "y" 240
	GuiControl, ping: Show, Pong
	sleep 400
	First_Game := true
	gosub, Pong_Moves
}

Side_to_Side_User()
{
	global
	if (User_Ping_Middle > PongX)
		rotation := "Left"
	if (User_Ping_Middle < PongX)
		rotation := "Right"
	return, rotation
}

Side_to_Side_PC()
{
	global
	if (PC_Ping_Middle > PongX)
		rotation := "Left"
	if (PC_Ping_Middle < PongX)
		rotation := "Right"
	return, rotation
}

Rand( a=0.0, b=1 ) {
   IfEqual,a,,Random,,% r := b = 1 ? Rand(0,0xFFFFFFFF) : b
   Else Random,r,a,b
   Return r
}
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: PingPong game

11 Mar 2018, 00:14

Similar using midi!
Edit: On line 98 should be NoteOn(9, 38, 127) ; miss!
Attachments
Ping Pong.ahk
(12.64 KiB) Downloaded 163 times
euras
Posts: 429
Joined: 05 Nov 2015, 12:56

Re: PingPong game

11 Mar 2018, 05:45

rommmcek wrote:Similar using midi!
Edit: On line 98 should be NoteOn(9, 38, 127) ; miss!
nice sound effects :D now it's more "alive" :)
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: PingPong game

11 Mar 2018, 07:46

@euras: All credit, goes to you due to your awesome recently materialized ideas! (PingPong & Piano)
A little game, a little music and "my" AutoHotkey. (Inspired by: Λίγο κρασί, λίγο θάλασσα και το αγόρι μου.)
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: PingPong game

11 Mar 2018, 08:53

rommmcek wrote:Similar using midi!
Similar using midi + colors + internal tile 8-) :P
Attachments
Ping_Pong_Color_v1.2.ahk
(14.12 KiB) Downloaded 148 times
Last edited by SpeedMaster on 12 Mar 2018, 08:46, edited 2 times in total.
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: PingPong game

11 Mar 2018, 12:01

@SpeedMaster: Great colors!
I'm typical non gamer, but for some reason, am very impressed by this project!
I do have some plans with it!
But I think there might be one or two hidden bugs.
- first marginal: it seems to me that ball and edge of the bat aren't always precisely calculated.
- if true might be cardinal: it seems that after certain number of bat smashes the script crashes. (tested on OP too)
Attachments
Ping_Pong_Color_Test.ahk
(14.02 KiB) Downloaded 165 times
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: PingPong game

12 Mar 2018, 06:20

Thanks for the feedback.
rommmcek wrote: - it seems that after certain number of bat smashes the script crashes. (tested on OP too)
- I would rather say after a huge amount of smashes the game crashes. ( :idea: btw, you had a good idea to play the game at full speed. Tanks !)
- I doubt someone will play any AHK game more than 5 min. :roll:
- I'm more interested in how to program a game in AHK and learn some new tricks ;)
because obviously AHK GUI is not the easiest platform for making a game. :geek:
rommmcek wrote: - It seems to me that ball and edge of the bat aren't always precisely calculated.
- You are right. :? I made some small changes to force the bat to stay in playing area... that does not solve the problem but it's better. :problem:
I also remplaced ListView with Progress which seems to have a better redraw.

Cheers
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: PingPong game

12 Mar 2018, 06:24

@ boiler, the sound works good on win7 too :thumbup:
@ rommmcek, great stuff.
@ SpeedMaster :shock: :clap:.

Cheers.
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: PingPong game

12 Mar 2018, 08:49

SpeedMaster wrote: Similar using midi + colors + internal tile 8-) :P
Version 1.2 compatible windows 10 ;)
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: PingPong game

12 Mar 2018, 14:38

- If the movement for the bat could be slightly more granular, i.e. an option to set it to the pixel would be good, I find when the ball first falls you either *just* miss it, or the next granular step is fairly far along the bat. I can't do the really cool edge hits.
- Also, the left/right hotkeys interfere with other windows.
- Really good game, cheers.

- Btw check out Paddle War, from Keen 4.
[with great commentary]
Commander Keen 4 - Paddle Wars - YouTube
https://www.youtube.com/watch?v=CGAi0qdJG6w
[with old-school sound effects]
Paddle War - YouTube
https://www.youtube.com/watch?v=sNldOlIhBq0
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
euras
Posts: 429
Joined: 05 Nov 2015, 12:56

Re: PingPong game

12 Mar 2018, 15:03

jeeswg wrote:- If the movement for the bat could be slightly more granular, i.e. an option to set it to the pixel would be good, I find when the ball first falls you either *just* miss it, or the next granular step is fairly far along the bat. I can't do the really cool edge hits.
- Also, the left/right hotkeys interfere with other windows.
- Really good game, cheers.

- Btw check out Paddle War, from Keen 4.
[with great commentary]
Commander Keen 4 - Paddle Wars - YouTube
https://www.youtube.com/watch?v=CGAi0qdJG6w
[with old-school sound effects]
Paddle War - YouTube
https://www.youtube.com/watch?v=sNldOlIhBq0
Thanks :) My first target for creating this game was to create "an engine" for motions, PC reaction and so on. There is space for improvements for sure and there can be small bugs too. To be honest, I'm still not happy with the engine I created, it looks too "lame" for me, but that's my level so far.
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: PingPong game

13 Mar 2018, 15:17

I believe, problem of the bat edge is only on the left side. To firefight it use User_Full_Ping_Start := User_PingX - 15 and PC_Ping_Start := PC_PingX - 15.

The script is using gosub command to jump between Pong_Moves: and Pong_Moves_UP: labels, but the command return is never executed. They accumulate and eventually AutoHotkey runs out of memory. Replacing gosub with goto seems to work.

Now the test would be boring so there is no update.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: gwarble and 130 guests