Compare commits
2 Commits
fe97b2ca13
...
bbdead0b2e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbdead0b2e | ||
|
|
4eaf0dbd98 |
1
TODO.md
1
TODO.md
@@ -1,5 +1,4 @@
|
|||||||
# TODO
|
# TODO
|
||||||
- szöveg rendszer
|
|
||||||
- menü rendszer
|
- menü rendszer
|
||||||
- overworld
|
- overworld
|
||||||
- csata
|
- csata
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 244 B |
Binary file not shown.
|
Before Width: | Height: | Size: 260 B |
Binary file not shown.
|
Before Width: | Height: | Size: 240 B |
Binary file not shown.
|
Before Width: | Height: | Size: 267 B |
@@ -1,10 +1,6 @@
|
|||||||
import arcade
|
import arcade
|
||||||
|
|
||||||
sprites = {
|
sprites = {
|
||||||
"louisu": arcade.load_texture("res/sprite/louisu.png"),
|
|
||||||
"louisd": arcade.load_texture("res/sprite/louisd.png"),
|
|
||||||
"louisl": arcade.load_texture("res/sprite/louisl.png"),
|
|
||||||
"louisb": arcade.load_texture("res/sprite/louisb.png"),
|
|
||||||
"cursor": arcade.load_texture("res/sprite/handcursor.png"),
|
"cursor": arcade.load_texture("res/sprite/handcursor.png"),
|
||||||
"font": arcade.load_spritesheet("res/sprite/font.png"),
|
"font": arcade.load_spritesheet("res/sprite/font.png"),
|
||||||
"panel": arcade.load_spritesheet("res/sprite/panel.png"),
|
"panel": arcade.load_spritesheet("res/sprite/panel.png"),
|
||||||
|
|||||||
38
src/controls.py
Normal file
38
src/controls.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import arcade
|
||||||
|
|
||||||
|
class Control:
|
||||||
|
def __init__(self, key, label):
|
||||||
|
self.key = key
|
||||||
|
self.label = label
|
||||||
|
self.pressed = False
|
||||||
|
self.held = False
|
||||||
|
|
||||||
|
controls = [
|
||||||
|
Control(arcade.key.W, "Fel"),
|
||||||
|
Control(arcade.key.S, "Le"),
|
||||||
|
Control(arcade.key.A, "Bal"),
|
||||||
|
Control(arcade.key.D, "Jobb"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def key_press(key):
|
||||||
|
for c in controls:
|
||||||
|
if c.key == key:
|
||||||
|
c.pressed = True
|
||||||
|
|
||||||
|
def key_release(key):
|
||||||
|
for c in controls:
|
||||||
|
if c.key == key:
|
||||||
|
c.pressed = False
|
||||||
|
c.held = False
|
||||||
|
|
||||||
|
def update():
|
||||||
|
for c in controls:
|
||||||
|
if c.pressed:
|
||||||
|
c.pressed = False
|
||||||
|
c.held = True
|
||||||
|
|
||||||
|
def is_control_pressed(cid):
|
||||||
|
return controls[cid].pressed
|
||||||
|
|
||||||
|
def is_control_held(cid):
|
||||||
|
return controls[cid].held
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import arcade
|
|
||||||
import assets
|
|
||||||
import text
|
|
||||||
|
|
||||||
text = text.TextRenderer(0, 100, 200)
|
|
||||||
|
|
||||||
def switch():
|
|
||||||
text.reset("●A bölcs, gyors, fürge róka zöld ágon ül, miközben egy tyúk csípős paprikát főz, és egy whiskyvel teli dobozt cipelő dzsesszzenész kvázi jókedvűen fütyörészik.")
|
|
||||||
text.type_all()
|
|
||||||
|
|
||||||
def update(dt):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def draw(game):
|
|
||||||
text.render()
|
|
||||||
@@ -1,17 +1,23 @@
|
|||||||
import arcade
|
import arcade
|
||||||
import assets
|
import assets
|
||||||
|
import controls
|
||||||
import text
|
import text
|
||||||
import renderers
|
import renderers
|
||||||
|
|
||||||
text = text.TextRenderer(6, 186, 210)
|
text = text.TextRenderer(6, 186, 210)
|
||||||
panel = renderers.NineSlicesPanel(0,100,230,100);
|
panel = renderers.NineSlicesPanel(0,100,230,100)
|
||||||
|
|
||||||
def switch():
|
def switch():
|
||||||
text.reset("●A bölcs, gyors, fürge róka zöld ágon ül, miközben egy tyúk csípős paprikát főz, és egy whiskyvel teli dobozt cipelő dzsesszzenész kvázi jókedvűen fütyörészik.")
|
pass
|
||||||
text.type_all()
|
|
||||||
|
|
||||||
def update(dt):
|
def update(dt):
|
||||||
pass
|
controltext = ""
|
||||||
|
|
||||||
|
for c in controls.controls:
|
||||||
|
controltext += f"{c.label}: {c.pressed}-{c.held}\n"
|
||||||
|
|
||||||
|
text.reset(controltext)
|
||||||
|
text.type_all()
|
||||||
|
|
||||||
def draw(game):
|
def draw(game):
|
||||||
arcade.draw_rect_filled(
|
arcade.draw_rect_filled(
|
||||||
@@ -20,4 +26,4 @@ def draw(game):
|
|||||||
)
|
)
|
||||||
|
|
||||||
panel.render()
|
panel.render()
|
||||||
text.render()
|
text.render()
|
||||||
@@ -2,6 +2,7 @@ import arcade
|
|||||||
import assets
|
import assets
|
||||||
import gamestate
|
import gamestate
|
||||||
import renderers
|
import renderers
|
||||||
|
import controls
|
||||||
import text
|
import text
|
||||||
|
|
||||||
SCREEN_WIDTH = 256
|
SCREEN_WIDTH = 256
|
||||||
@@ -33,6 +34,13 @@ class Game(arcade.Window):
|
|||||||
|
|
||||||
def on_update(self, dt):
|
def on_update(self, dt):
|
||||||
gamestate.update(dt)
|
gamestate.update(dt)
|
||||||
|
controls.update()
|
||||||
|
|
||||||
|
def on_key_press(self, symbol, modifiers):
|
||||||
|
controls.key_press(symbol)
|
||||||
|
|
||||||
|
def on_key_release(self, symbol, modifiers):
|
||||||
|
controls.key_release(symbol)
|
||||||
|
|
||||||
def on_draw(self):
|
def on_draw(self):
|
||||||
self.framebuffer.use()
|
self.framebuffer.use()
|
||||||
|
|||||||
@@ -23,9 +23,11 @@ class TextRenderer:
|
|||||||
self.y = y
|
self.y = y
|
||||||
|
|
||||||
def reset(self, text):
|
def reset(self, text):
|
||||||
self.text = text
|
self.text = text
|
||||||
self.textptr = 0
|
self.textptr = 0
|
||||||
self.sprites = []
|
self.sprites = []
|
||||||
|
self.x = self.base_x
|
||||||
|
self.y = self.base_y
|
||||||
|
|
||||||
def amend(self, text):
|
def amend(self, text):
|
||||||
self.text = self.text + text
|
self.text = self.text + text
|
||||||
|
|||||||
Reference in New Issue
Block a user