angelxz/EBIGU
EBIGU aka Extraordinary Basically Ingenious Gamemaking Utility is a simple "language" which I wrote in python for exactly 3 days. It is mainly for creating 2D games. Oh yes, and it is in Bulgarian, not in Cyrillic though.
EBIGU
EBIGU [ibígu] aka Extraordinary Basically Ingenious Gamemaking Utility is a simple "programming language" which I wrote in python for exactly 3 days xD It is mainly made for creating 2D games (using pygame as a base). Oh yes, and it is in Bulgarian :D (not in cyrillic though)
You can also write pure python in .ebigu files and mix it with EBIGU, no probs
Installation
You can either just clone the source code or download a compiled version from the latest release
Usage
Just open your .ebigu file with the EBIGU.py or EBIGU.exe
py EBIGU.py hello_world.ebigu
EBIGU.exe hello_world.ebiguIf you specify a thirt parameter (a python file) the source code will be translated and written in that file. (rather than executed)
py EBIGU.py hello_world.ebigu my_cool_file.pyContributing
I am 100% open for any ideas and contibutions :D
Hello World
izpishi('Zdravei Svqt')
If ya wan't a more thorough hello world check out the hello_world folder in the repo. It is a simple af game which I wrote in the process of testing the language, perfect to get ya started. Btw, the assets are just some stuff I downloaded from the Internet so be careful with copyright and stuff if you intend to use them.
The Docs
The official documentation of EBIGU :D
The Basics
Assigning a variable:
kon = 'Mustang'
listche = [1, 2, 3]
If else statement:
ako kon e 'Mustang' ili 3 ne v listche: # if kon == 'Mustang' or 3 not in listche
ne pravi nishto # pass
ako li puk kon ne e 'Pesho' i kon ne e 'Gosho': # elif kon != 'Pesho' and kon != 'Gosho'
izpishi('Kude li sa Pesho i Gosho') # print
inache: # else
ne_znam = vqrno # vqrno -> False, nevqrno -> True
# BTW the tabs are important... Just sayin'
# And they have to tabs tabs, not spaces
Loops:
za l v obseg(30): # for l in range(30)
izpishi(l)
broqch = 0
dokato vqrno: # while True
ako broqch e 31:
preskochi # continue
ako li puk broqch e 100:
schupi # break
inache:
izpishi(broqch)
broqch += 1
Functions:
kato izvikam kvo_staa(na_kef_sum): # def kvo_staa(na_kef_sum):
globalni nqkva_globalna_promenliva # global nqkva_globalna_promenliva
ako na_kef_sum e vqrno:
izpishi('Na kef sum')
inache:
vurni # return
Comments:
# Az sum komentar
Random:
sluchaino(0, 9) # random.randint(0, 9)
The cool stuff
Here you can find all the gamemaking EBIGU actions
Initializing the game
Initialize new game and set the window size (compulsory):
prozorcheto da mi bude (width, height)
Set window icon:
ikonkata da mi bude ./path/to/icon.png
Set window caption (title):
igrata mi se kazva 'Nai qkata igra na zemqta'
Set desired fps:
# Default is 30 (you don't really need to set this)
nadqvam se igrata mi da vurvi s 60 fps
Set background (colors can be either in hex or rgb values):
fonut da mi bude ./path/to/background.jpg
fonut da mu bude #ffffff
Ifs and checkers
! Every one of these has to be in the "osnoven cikul" aka the main game loop
Check if mouse has been clicked:
ako mishkata e cuknata:
...
Check if the mouse is currently in motion:
ako mishkata murda:
...
Check if the button specified has been clicked:
ako nqkuv_qk_buton e kliknat:
...
Check if a certain key is pressed:
(you can find the full list of key names here)
ako K_UP e natisnat:
...
Collision detection between two sprites (aka heroes):
ako sprite1 se blusne s sprite2:
...
Collision detection between a sprite and a group of sprites:
ako sprite se blusne s neshto ot group:
...
Check if a sprite (aka hero) is outside the window boundaries:
ako sprite izleze ot poleto:
...
Check if an event is happening:
ako subitie NQKAKVO_SUBITIE:
...
Create a new hero object (sprite):
igrach = nov geroi s golemina (width, height) i sprite ./path/to/player.png
krugche= nov geroi s golemina (width, height) i sprite krugche i cvqt #d8f83f
# default color is #ffffff so it is not a compulsory parameter
pravougulniche = nov geroi s golemina (width, height) i sprite pravougulniche
Create a new font object (needed for buttons and texts):
fontche = nov font ./path/to/fontche.ttf s golemina 40
Create a new text object:
krai_text = nov text 'Krai na igrata' s font fontche i cvqt #ffffff
Create a new button object:
igrai_buton = nov buton 'Igrai' s cvqt #ffffff i fonov cvqt #000000 i cvqt #0f0f0f pod kursora i font fontche i golemina (width, height)
Create a new event:
# Always has to be in uppercase
NOVO_SUBITIE = novo subitie
Audio
Load a new sound:
lazer_zvuk = nov zvuk ./path/to/lazer.wav
Play sound:
izpei lazer_zvuk
Set sound volume:
izpeivai lazer_zvuk s 0.5 zvuk
Play music (looped):
pei ./path/to/muzichka.mp3
Set the music volume:
pei s 1.3 zvuk
Pause the music:
pauzirai peeneto
Unpause the music:
otpauzirai peeneto
Stop the music:
q zemi se sopri s tva tvoe peene
Manipulating the sprites (hero objects)
Draw a sprite:
plesni igrach na (x, y)
Remove a sprite:
mahni igrach
Move a sprite to a certain location:
mrudni igrach na (x, y)
Move a sprite by some pixels:
mrudni igrach s (x, y)
Change size of a sprite:
napravi igrach (width, height)
Rotate sprite:
zavurti igrach s 90 gradusa
Some useful get actions
Get current mouse position (works only in "osnoven cikul"):
poz_mishka = poziciq na mishkata
Get the position of a sprite:
poz_igrach = poziciq na igrach
Get the size of a sprite:
golemina_igrach = golemina na igrach
Animations
Add an animation to a sprite (the sprite has to be first "plesnat" (drawn)):
# The folder has to consist of the animation's images only
# and they should be numbered in the right order
igrach_animaciq = nova animaciq na igrach ot ./path/to/folder
Play animation:
animirai igrach_animaciq na igrach
Play animation on a whole group:
animirai vrag_animaciq na grupa vragove
Sprite groups
- used to store multiple sprites in the same place for ease
Create a new sprite group:
vragove = nova grupa
Add to group (and draw):
dobavi vrag v vragove i go plesni na (x, y)
Remove from group:
mahni vrag ot vragove
Empty a group:
izprazni grupa vragove
Other useful actions
Post an event after a given amount of milleseconds:
sled 1000 ms NOVO_SUBITIE
Post an event every n amount of milleseconds:
prez 2000 ms RODI_VRAG
Start counting the elapsed time (the izminalo_vreme var):
# All the clock actions work only in the "osnoven cikul" aka the main game loop
# Also by default the clock is not counting
pusni chasovnika
Pause the counting of elapsed time:
pauzirai chasovnika
Reset the counting of elapsed time:
nulirai chasovnika
Show the cursor:
pokazhi kursora
Hide the cursor:
skrii kursora
The main game loop function
osnoven cikul:
...
Quit game
Can only be used in the main game loop
krai na igrata
End of EBIGU file (when making a game):
! Compulsory
# This is the final line of my beautiful game!
dobra igra
Special variables
Screen width and height:
SHIRINA_EKRAN # -> gives you the width of the screen
VISOCHINA_EKRAN # -> gives you the height of the screen
Center of the screen:
CENTER # -> [centerx, centery]
The set fps:
FPS # -> a number (what you have set or the default 30)
Time elapsed since you started the clock:
# Can only be accessed from the "osnoven cikul"
izteklo_vreme # -> gives you the number of seconds elapsed since the clock was started
Time elapsed between each loop in the "osnoven cikul" aka the main game loop:
# Can only be accessed from the "osnoven cikul"
dt # -> gives you the number of seconds elapsed between each loop
Feel free to add more features and happy codin'!