-
Notifications
You must be signed in to change notification settings - Fork 1
/
splash_scene.py
64 lines (49 loc) · 2.11 KB
/
splash_scene.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
# Created by: Mr. Coxall
# Created on: Nov 2017
# Created for: ICS3U
# This scene shows a splash screen for 2 seconds,
# then transitions to the main menu.
from scene import *
import ui
import time
from main_menu_scene import *
class SplashScene(Scene):
def setup(self):
# this method is called, when user moves to this scene
# create timer, so that after 2 seconds move to next scene
self.start_time = time.time()
# add MT blue background color
self.background = SpriteNode(position = self.size / 2,
color = (0.61, 0.78, 0.87),
parent = self,
size = self.size)
self.school_crest = SpriteNode('./assets/sprites/MT_Game_Studio.png',
parent = self,
position = self.size/2,
size = self.size)
def update(self):
# this method is called, hopefully, 60 times a second
# after 2 seconds, move to main menu scene
if not self.presented_scene and time.time() - self.start_time > 1:
self.present_modal_scene(MainMenuScene())
def touch_began(self, touch):
# this method is called, when user touches the screen
pass
def touch_moved(self, touch):
# this method is called, when user moves a finger around on the screen
pass
def touch_ended(self, touch):
# this method is called, when user releases a finger from the screen
pass
def did_change_size(self):
# this method is called, when user changes the orientation of the screen
# thus changing the size of each dimension
pass
def pause(self):
# this method is called, when user touches the home button
# save anything before app is put to background
pass
def resume(self):
# this method is called, when user place app from background
# back into use. Reload anything you might need.
pass