-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
84 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from forges.entity import Entity | ||
from forges.sprite import Sprite | ||
from forges.color import Color | ||
from forges.math import lerp | ||
|
||
import time | ||
|
||
class Intro(Entity): | ||
def __init__(self): | ||
super().__init__(color = Color(0, 0, 0, 255), layer = -1) | ||
|
||
self.logo = Sprite(self.engine.path + "/assets/logo/logo.png", alpha = 0, width = 350, height = 80, layer = -1) | ||
self.logo.update = self.update_logo | ||
|
||
self.target_alpha = self.color.a | ||
self.target_logo_alpha = self.logo.alpha | ||
|
||
def update_logo(self): | ||
self.logo.center() | ||
|
||
if self.engine.window.start_time + 5 < time.time(): | ||
self.target_logo_alpha = lerp(self.target_logo_alpha, 0, 0.05) | ||
self.logo.set_alpha(int(self.target_logo_alpha)) | ||
|
||
if self.logo.alpha == 0: | ||
self.logo.destroy() | ||
|
||
elif self.engine.window.start_time + 0.5 < time.time(): | ||
self.target_logo_alpha = lerp(self.target_logo_alpha, 255, 0.01) | ||
self.logo.set_alpha(int(self.target_logo_alpha)) | ||
|
||
def update(self): | ||
self.width = self.engine.window.width | ||
self.height = self.engine.window.height | ||
|
||
if self.engine.window.start_time + 7 < time.time(): | ||
self.target_alpha = lerp(self.target_alpha, 0, 0.1) | ||
self.color.a = int(self.target_alpha) | ||
|
||
if self.color.a == 0: | ||
self.destroy() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from forges.prefabs.top_view_controller import TopViewController | ||
from forges.prefabs.platformer_controller import PlatformerController | ||
from forges.prefabs.button import Button | ||
from forges.prefabs.camera import Camera | ||
from forges.prefabs.camera import Camera | ||
from forges.prefabs.checkbox import CheckBox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import forges | ||
|
||
from forges.prefabs.button import Button | ||
|
||
class CheckBox(Button): | ||
def __init__(self, normal_color = forges.color.Color(200, 200, 200), press_color = forges.color.Color(100, 100, 100), highlight_color = forges.color.Color(150, 150, 150), width = 20, height = 20, x = 0, y = 0, color = forges.color.Color(6, 6, 8), fill = True, parent = None, layer = 1): | ||
super().__init__(normal_color = normal_color, press_color = press_color, highlight_color = highlight_color, width = width, height = height, x = x, y = y, color = color, fill = fill, parent = parent, layer = layer) | ||
|
||
self.functions["on_release"] = self.update_state | ||
self.state = False | ||
|
||
self.box = forges.Entity(width = self.width - 10, height = self.height - 10, x = 5, y = 5, parent = self) | ||
self.box.visible = False | ||
|
||
def update_state(self): | ||
self.state = not self.state | ||
self.box.visible = True if self.state else False | ||
|
||
def get_state(self): | ||
return self.state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters