-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtamagotchi.py
executable file
·71 lines (55 loc) · 1.58 KB
/
tamagotchi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
# coding=utf-8
import tamaView.window as window
from tamaView.window_stat import *
from tamaCore.Tamagotchi import Tamagotchi
from tamaCore.SpeciesList import *
def main():
global tick_rate
global tick_difficulty
screen, clock = window.start()
tama = None
done = False
function = window.start_scene
# Menu
while (not done):
done, action = function(screen, done)
if(not done and action is not None):
function, tama = action()
#if(action is not None):
#while (not done):
tama = Ball()
done_event = False
function = window.main_scene
tick_count = 0
done = False
# Game
while(not done):
#update Graphics
action, args_action, done, done_event = window.updateScreen(tama, screen, done)
# --- Game logic
if(action is not None and not done_event):
action(args_action)
done_event = True
#if(action is not None and not done_event):
if(action == tama.eat):
action(args_action)
done_event = True
#pass time
tick_count += 1
print "grinch ", tick_count, " ", tick_difficulty, " ", tick_rate
if(tick_count >= tick_rate):
tama.pass_time(tick_difficulty)
tick_count = 0
#if(tick_count == tick_rate):
#check if dead
if(tama.is_dead()):
done = True
#if(tama.is_dead()):
clock.tick(tick_rate)
#while(not done):
#def main()
main()
print "grinch I QUIT!"
window.quit()
print "grinch QUITTED"