Skip to content

Commit dd5933e

Browse files
committed
Adicionando arquivos iniciais.
- Música de teste - SFX de teste - Spritemap de teste - Programação inicial
1 parent 42d7d67 commit dd5933e

File tree

10 files changed

+125
-0
lines changed

10 files changed

+125
-0
lines changed

DejaVuSans.ttf

703 KB
Binary file not shown.

aoko.png

1.25 MB
Loading

aoko.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/python
2+
# -*- coding: utf-8 -*-
3+
4+
data = {
5+
"idle" : {
6+
"start" : [],
7+
"frames" : [
8+
{ "x": 0, "y": 0, "w": 58, "h": 109 },
9+
{ "x": 59, "y": 0, "w": 58, "h": 109 },
10+
{ "x": 115, "y": -1, "w": 58, "h": 109 },
11+
{ "x": 167, "y": 0, "w": 58, "h": 109 },
12+
{ "x": 221, "y": 0, "w": 58, "h": 109 },
13+
{ "x": 271, "y": 0, "w": 58, "h": 109 },
14+
{ "x": 323, "y": 0, "w": 58, "h": 109 },
15+
{ "x": 378, "y": 0, "w": 58, "h": 109 },
16+
],
17+
"recover" : [],
18+
},
19+
"walk" : {
20+
"start" : [
21+
{ "x": -5, "y": 235, "w": 58, "h": 109 },
22+
{ "x": 50, "y": 235, "w": 58, "h": 109 },
23+
{ "x": 102, "y": 235, "w": 58, "h": 109 },
24+
],
25+
"frames" : [
26+
{ "x": 162, "y": 235, "w": 58, "h": 109 },
27+
{ "x": 224, "y": 235, "w": 58, "h": 109 },
28+
{ "x": 285, "y": 235, "w": 58, "h": 109 },
29+
{ "x": 353, "y": 235, "w": 58, "h": 109 },
30+
{ "x": 433, "y": 235, "w": 70, "h": 109 },
31+
{ "x": 512, "y": 235, "w": 70, "h": 109 },
32+
{ "x": 595, "y": 235, "w": 70, "h": 109 },
33+
],
34+
"recover" : [
35+
{ "x": 102, "y": 235, "w": 58, "h": 109 },
36+
{ "x": 50, "y": 235, "w": 58, "h": 109 },
37+
{ "x": -5, "y": 235, "w": 58, "h": 109 },
38+
],
39+
}
40+
}
41+
42+
state = "idle"
43+
44+
i = 0;
45+
m = len(data[state]["frames"])

ball.wav

26.7 KB
Binary file not shown.

cute_image.jpg

82 KB
Loading

main.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/python
2+
# -*- coding: utf-8 -*-
3+
4+
import sfml as sf
5+
import aoko
6+
7+
input_free = True
8+
9+
class application :
10+
11+
def __init__(self):
12+
self.window = sf.RenderWindow(sf.VideoMode(800, 600), "Game")
13+
14+
self.image = sf.Image.from_file("aoko.png")
15+
self.image.create_mask_from_color(sf.Color(255, 255, 255))
16+
self.sprite = sf.Sprite(sf.Texture.from_image(self.image))
17+
self.sprite.ratio = sf.Vector2(2, 2)
18+
19+
while self.window.is_open :
20+
self.read_input()
21+
self.update()
22+
self.draw()
23+
24+
sf.sleep(sf.seconds(0.1))
25+
26+
27+
def read_input(self) :
28+
global input_free
29+
30+
for event in self.window.events :
31+
if type(event) is sf.CloseEvent :
32+
self.window.close()
33+
34+
if input_free == False and type(event) is sf.KeyEvent and not event.pressed :
35+
aoko.state = "idle"
36+
aoko.i = 0
37+
aoko.m = len(aoko.data[aoko.state]["frames"])
38+
input_free = True
39+
40+
if input_free and type(event) is sf.KeyEvent and event.pressed and event.code is sf.Keyboard.SPACE :
41+
aoko.state = "walk"
42+
aoko.i = 0
43+
aoko.m = len(aoko.data[aoko.state]["frames"])
44+
input_free = False
45+
46+
def update(self) :
47+
pass
48+
49+
def draw(self) :
50+
self.window.clear()
51+
52+
self.sprite.texture_rectangle = sf.Rectangle(
53+
sf.Vector2(aoko.data[aoko.state]["frames"][aoko.i]["x"], aoko.data[aoko.state]["frames"][aoko.i]["y"]),
54+
sf.Vector2(aoko.data[aoko.state]["frames"][aoko.i]["w"], aoko.data[aoko.state]["frames"][aoko.i]["h"])
55+
)
56+
57+
self.window.draw(self.sprite)
58+
59+
aoko.i = (aoko.i + 1) % aoko.m
60+
print self.sprite.texture_rectangle
61+
62+
self.window.display()
63+
64+
application()

msvcp90.dll

556 KB
Binary file not shown.

music.ogg

5.99 MB
Binary file not shown.

setup.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from glob import glob
2+
from distutils.core import setup
3+
import py2exe
4+
import sys
5+
6+
data_files = [("Microsoft.VC90.CRT", glob(r'C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*'))]
7+
8+
setup(console=['main.py'], data_files=data_files)

setup.py~

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from glob import glob
2+
from distutils.core import setup
3+
import py2exe
4+
import sys
5+
6+
data_files = [(sys.path.append("C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\redist\\x86\\Microsoft.VC90.CRT"))]
7+
8+
setup(console=['main.py'], data_files=data_files)

0 commit comments

Comments
 (0)