Pacman Kinda

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
IcarusLives
Posts: 175
Joined: 17 Jan 2016 23:55

Pacman Kinda

#1 Post by IcarusLives » 08 Apr 2023 15:31

Here is a Pacman styled game in pure batch. Windows 10 or later.

Image

Eat as many DOTS as you can before the CHASER gets you!

Use WASD to move around.

Cherries to turn into "The predator" where Pacman turns RED for the duration, and the CHASER becomes the CHASED.
Shields to increase how many times the CHASER can hit you.
PowerUps to increase your speed for a short duration.
Snowflakes - Freeze the Chaser in place
Poofs - Teleport the Chaser out of sight
Magnets - DOTS are magnetically drawn to you if you get close enough
Invisible - Makes you invisible to the Chaser
Teleport - Randomly teleports you and the Chaser

Periodically, the CHASER has a random chance to increase it's speed, so you will inevitably be caught, it's up to you how long that takes!

Pacman_Kinda.bat
https://github.com/IcarusLivesHF/Batch- ... _kinda.bat
Library.bat
https://github.com/IcarusLivesHF/Window ... ibrary.bat

Please enjoy :)

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Pacman Kinda

#2 Post by einstein1969 » 18 Apr 2023 02:41

very beatiful!!!

How did you make those drawings?

IcarusLives
Posts: 175
Joined: 17 Jan 2016 23:55

Re: Pacman Kinda

#3 Post by IcarusLives » 18 Apr 2023 19:20

einstein1969 wrote:
18 Apr 2023 02:41
very beatiful!!!

How did you make those drawings?
Hi einstein! Thank you for asking, and your attention :)

In order to create these "sprites", I utilize VT100 escape sequences in windows 10.

Here is a few examples

Code: Select all

set "cherry=[2C[38;2;97;138;61m_[B[3D[C[38;2;159;100;66m/[B[3D[38;2;255;0;0m°[38;2;255;0;0mÛ[B[2D[38;2;255;0;0mÛÛ[A[D[0m"
set "shield=[38;5;12m'-'-'[B[5D[38;5;12m^|[38;5;7mÛSÛ[38;5;12m^|[B[5D[38;5;12m^|[38;5;7mÛÛÛ[38;5;12m^|[B[5D[38;5;12m\___/[3D[2A[0m" 
set "powerUp=[38;5;9m[C/\[B[3D/[38;5;15m+1[38;5;9m\[B[4D`ÛÛ'[B[4D[CÛÛ[D[A[0m"
I would like to make a note that there are ESC characters in this code above, but dostips makes them invisible.

If you'd like to capture ESC yourself, you can use this

Code: Select all

for /f %%a in ('echo prompt $E^| cmd') do set "esc=%%a"
You can see usage for VT100 here :)
https://learn.microsoft.com/en-us/windo ... -sequences

In attempt to explain the best I can how I make my sprites, I use

Code: Select all

ESC[nC to shift the cursor RIGHT n spaces
ESC[nD to shift the cursor LEFT n spaces
ESC[nB to shift the cursor DOWN n spaces
ESC[nA to shift the cursor UP n spaces

ESC[38;2;R;G;Bm to COLOR the following character(s)

ESC[0m to turn off all attibutes so the sprite doesn't bleed into the environment with colors.
I hope this helps :)

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Pacman Kinda

#4 Post by einstein1969 » 19 Apr 2023 15:39

I assume that you use special fonts to draw in this way.

I can't find the part in question in the code.

Can you tell me?

IcarusLives
Posts: 175
Joined: 17 Jan 2016 23:55

Re: Pacman Kinda

#5 Post by IcarusLives » 20 Apr 2023 18:44

No sir! No special fonts. My library from my github has installing fonts disabled as a default.

What I assume you mean is the ascii characters I used in ANSI encoding?

Lets closely observe this sprite :) (as I mentioned, dostips removes the ESC character from this line of code below so I will use %ESC% to show)

Code: Select all

set "cherry=[2C[38;2;97;138;61m_[B[3D[C[38;2;159;100;66m/[B[3D[38;2;255;0;0m°[38;2;255;0;0mÛ[B[2D[38;2;255;0;0mÛÛ[A[D[0m"
This is the VT100 sequence to draw a very ugly cherry lol. Following the logic I mentioned last time, C = RIGHT, B = DOWN, D = LEFT, A = UP

Code: Select all

set "cherry=
%esc%[2C
%esc%[38;2;97;138;61m_
%esc%[B
%esc%[3D
%esc%[C
%esc%[38;2;159;100;66m/
%esc%[B
%esc%[3D
%esc%[38;2;255;0;0m°
%esc%[38;2;255;0;0mÛ
%esc%[B
%esc%[2D
%esc%[38;2;255;0;0mÛÛ
%esc%[A
%esc%[D
[0m"
As you can see, I draw a special character after a COLORING sequence, for example

Code: Select all

%esc%[38;2;255;0;0mÛ

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Pacman Kinda

#6 Post by einstein1969 » 21 Apr 2023 09:45

I swear I was convinced that they were pixels, your drawings are fantastic and so simple.

I like that kind of magnet that has the part in shadow and looks three-dimensional.

You can make very nice games.

IcarusLives
Posts: 175
Joined: 17 Jan 2016 23:55

Re: Pacman Kinda

#7 Post by IcarusLives » 21 Apr 2023 14:27

It took me a little while to finally come up with ascii art that looked good. Thank you so much! I appreciate it :)

Post Reply