52 lines
2.3 KiB
Markdown
52 lines
2.3 KiB
Markdown
# hashengine-copyright-justus-2022
|
|
|
|
# run the demo programm
|
|
to run the demo programm just execute the module and make sure you have these modules installed:
|
|
time
|
|
ctypes
|
|
os
|
|
keyboard
|
|
|
|
# what modules the hashengine need:
|
|
|
|
the hashengine module needs the os module
|
|
|
|
# how to use the module
|
|
|
|
how to make an box that spawns in air:
|
|
```python
|
|
import time #imports the time module
|
|
import main #imports the hashengine module
|
|
game = main.game() # makes a variable with the game instance
|
|
box = main.object("#", y=10, gravity=0.1, antixforce=1) # creates the box antixforce selects the braking gravity selects the gravity y selects the y start position x selects the x start position character selects what character the object should be in our case a hashtag just experiment with the settings and you may programm something cool!
|
|
game.addobj(box) # adds the box to the game so the game knows that it exists
|
|
while True:
|
|
game.update() # makes an update for every object in the game
|
|
time.sleep(0.05)
|
|
|
|
```
|
|
|
|
if you want to control the hashtag use this code:
|
|
```python
|
|
|
|
import time #imports the time module
|
|
import main #imports the hashengine module
|
|
import keyboard #imports the keyboard module
|
|
game = main.game() # makes a variable with the game instance
|
|
box = main.object("#", y=10, gravity=0.1, antixforce=1) # creates the box antixforce selects the braking gravity selects the gravity y selects the y start position x selects the x start position character selects what character the object should be in our case a hashtag just experiment with the settings and you may programm something cool!
|
|
game.addobj(box) # adds the box to the game so the game knows that it exists
|
|
while True:
|
|
if keyboard.is_pressed("d"):
|
|
box.xvelocity -= 1 # sets it xvelocity experiment with it and you find out its for movement
|
|
elif keyboard.is_pressed("a"):
|
|
box.xvelocity += 1 # sets it xvelocity experiment with it and you find out its for movement
|
|
elif keyboard.is_pressed("w"):
|
|
box.yvelocity += 1 # sets it yvelocity experiment with it and you find out its for movement
|
|
elif keyboard.is_pressed("s"):
|
|
box.yvelocity -= 1 # sets it yvelocity experiment with it and you find out its for movement
|
|
elif keyboard.is_pressed("q"):
|
|
exit() # exits the game
|
|
game.update() # makes an update for every object in the game
|
|
time.sleep(0.05)
|
|
|
|
``` |