PingPong game

Post your working scripts, libraries and tools
euras
Posts: 335
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] [Expand] [Download] GeSHi © Codebox Plus

Helgef
Posts: 3163
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: 179
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: 212
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: 335
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: 2372
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] [Expand] [Download] GeSHi © Codebox Plus

rommmcek
Posts: 371
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 28 times
euras
Posts: 335
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" :)
rommmcek
Posts: 371
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: 212
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 26 times
Last edited by SpeedMaster on 12 Mar 2018, 08:46, edited 2 times in total.
rommmcek
Posts: 371
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 25 times
User avatar
SpeedMaster
Posts: 212
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: 3163
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: 212
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: 4990
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
euras
Posts: 335
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.
rommmcek
Posts: 371
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”

Who is online

Users browsing this forum: No registered users and 28 guests