Skip to content

Commit

Permalink
Done. Finally. Done
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkauzh committed Feb 10, 2024
1 parent 20aa162 commit e14c089
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 18 deletions.
10 changes: 8 additions & 2 deletions docs/changelog/v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
- [x] Added support for SpriteSheets
- [x] Draw function gets frames argument

# V5.2
## V5.2
- [x] Custom OpenGL (FusionGL)
- [x] Using Ctypes
- [x] Ported all functions
Expand All @@ -50,7 +50,13 @@
- [x] Deprecated
- [x] New entities called Nodes

- [ ] Node
- [x] Node
- [x] Some new features
- [x] Moved features from entity system (and fixed them)

## V5.3
- [ ] State Machine
- [ ] Custom states
- [ ] Easy to use


36 changes: 30 additions & 6 deletions docs/tutorials/character.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
---
hide:
- navigation
---
# Basic Moving Character Tutorial
This is a tutorial how to build a basic moving character using fusion-engine. We wil be using the new Node system introduced in V5.2 to make everything easier.
We are going to make a small moving character. The character is gonna be a node with the fusion icon as image.

## Setting up
First, make sure you have the latest version of Fusion installed (V5.2 and later). Without this it won't work, as we will be using a feature introduced in that version.
If you want have fusion yet setup, then go back to [the setup tutorial](setup.md)

## Basic things
First, lets get the basic things setup, like a window and a loop.

First, we import `fusionengine` as `fusion`:
```python
import fusionengine as fusion
```

Then we create a window where all drawing will take place:
```python
window = fusion.Window("Basic Character - Fusion Engine", 800, 600)
```

After the window is done, we can create the loop:
```python
@window.loop
def loop():
... # Our code is gonna go here
```
Thats it! We have a basic window and loop setup!

## Getting the Node setup

# Platformer tutorial
This is a tutorial how to build a basic platformer using fusion-engine. This is not done yet. Sorry :).
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ nav:
- Tutorials:
- Setting up Fusion Engine: 'tutorials/setup.md'
- Basics of Fusion Engine: 'tutorials/basics.md'
- Small moving character: 'tutorials/character.md'


- Changelog:
Expand Down
2 changes: 1 addition & 1 deletion src/fusionengine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@

if platform.system().lower() == "linux":
warnings.filterwarnings(
"ignore", message="Pygame-ce seems to be running through X11 on top of wayland"
"ignore", message="PyGame seems to be running through X11 on top of wayland"
)
2 changes: 2 additions & 0 deletions src/fusionengine/engine/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,5 @@ def update(self):
draw.play()
else:
draw.draw()

self.to_draw = []
15 changes: 7 additions & 8 deletions src/fusionengine/examples/example3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

window = fusion.Window("Example: 3", 800, 600)

player = fusion.Entity(window, 50, 50, 50, 50)
player = fusion.Node(window, 50, 50, 50, 50)


speed = 10
SPEED = 10


@window.loop
Expand All @@ -15,15 +14,15 @@ def loop():
player.load_rect(fusion.AQUA)

if fusion.Key(fusion.KEY_UP).key_down() or fusion.Key(fusion.KEY_W).key_down():
player.y = int(player.y - speed)
player.y = player.y - SPEED

elif fusion.Key(fusion.KEY_DOWN).key_down() or fusion.Key(fusion.KEY_S).key_down():
player.y = int(player.y + speed)
player.y = player.y + SPEED

elif fusion.Key(fusion.KEY_RIGHT).key_down() or fusion.Key(fusion.KEY_D).key_down():
player.x = int(player.x + speed)
player.x = player.x + SPEED

elif fusion.Key(fusion.KEY_LEFT).key_down() or fusion.Key(fusion.KEY_A).key_down():
player.x = int(player.x - speed)
player.x = player.x - SPEED

player.draw_rect()
player.update()

0 comments on commit e14c089

Please sign in to comment.