hashengine-2022/README.md

46 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2022-08-05 21:19:17 +02:00
# hashengine-copyright-justus-2022
2022-08-06 18:19:25 +02:00
# 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
2022-09-07 16:29:10 +02:00
Heres a link to a pong Programm that I made with hash engine: https://git.l--n.de/justuswolff/hashengine_pong/src/branch/master/
2022-09-07 16:33:32 +02:00
# plugins
the new hashengine has a plugin system and theres a plugincompiler and a targetplugin file
in the targetplugin file you write plugins, and at the beginning it is a template plugin.
the #before is a marker and it marks for the compiler that when the update function was called it will be executed before the calculations
the #after marks that the code is run after the calculations and showing of the game
plugins need to be located under the plugins folder to be found.
## !WARNING!
malicious plugins are possible so be warned about them!