hashengine-2022/README.md

38 lines
1.9 KiB
Markdown
Raw Normal View History

2022-08-05 21:19:17 +02:00
# hashengine-copyright-justus-2022
2022-08-06 18:19:25 +02:00
if you want to edit it and publish it give credit's to me
# how to use the module:
## the game class:
at the beginning of every hashengine game you need to initialize the engine. thats automaticlly being made if you declear a variable to the game class, it will automaticlly install all dependencies
2022-08-05 21:19:17 +02:00
2022-08-06 18:19:25 +02:00
to get keys that are being pressed get the keys dictionary from the game class: game.pressedkeys
to play sounds use game.playsound as the path you give the path to the sound file, waitforfinish tells if the hashengine should wait with further code execution until the sound is done playing normal its set to False
the update function is being used for updating all objects in the game and also for updating the pressedkeys dictionary
to add a object you call the addobj function in the game class
and pass the object class
## the object class:
the object class is used for objects in the game
it stores data about the object but the calculating is doing the game not the object class itself
when you declear the object class then you need to pass this argument: character.
this tells how the object should look like in the game
example:
we give the object class the character "#" so when we add it in the game with addobj() then it shows up as "#"
the rest of the arguments are optional:
gravity selects the gravity for the object. normally 0.1
x selects the x starting position. normally 0
y selects the y starting position. normally 0
antixforce selects the braking when moving left or right. normally 0.1
the object class also has xvelocity and yvelocity, they are used to move the object around
example:
yvelocity is being set to 1:
then the object would fly up, height is depending on gravity
2022-08-10 17:09:41 +02:00
the same is with xvelocity but the xvelocity "gravity" is antixforce
# demo pong Programm
Heres a link to a pong Programm that I made with hash engine: https://git.l--n.de/justuswolff/hashengine_pong/src/branch/master/