Skip to content

Commit

Permalink
Initial release (ran out of time!)
Browse files Browse the repository at this point in the history
  • Loading branch information
tatjam committed Jul 11, 2022
1 parent 767c3e3 commit 705b14d
Show file tree
Hide file tree
Showing 17 changed files with 127 additions and 4 deletions.
Binary file modified res/clip3/backdrop0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/clip3/backdrop1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/clip3/backdrop2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/clip3/backdrop3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/clip3/bigboi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/clip3/sky0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/clip3/sky1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/clip3/sky2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/clip3/smallboi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/clip3/sun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/clip3/text0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/clip3/text1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/clip3/text2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/clip3/text3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
120 changes: 120 additions & 0 deletions src/game/scenes/cutsc3.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
include ../../engine/base
import ../../engine/graphics/shader


type CutScene3* = ref object of Scene
sky0: Sprite
sky1: Sprite
sky2: Sprite
sun: Sprite
eldritch: Sprite
big: Sprite
backdrop0: Sprite
backdrop1: Sprite
backdrop2: Sprite
backdrop3: Sprite

text: seq[Sprite]
text_prg: int
cur_time: float
text_time: float
text_times: seq[float]
music: WavHandle
time: float

method init(this: CutScene3) =
renderer.camera.center = vec2f(320, 150)
renderer.camera.scale = 1.0
renderer.fullscreen_shader = load_shader("res/shader/fullscreen_intro")

this.sky0 = create_sprite("res/clip3/sky0.png")
this.sky1 = create_sprite("res/clip3/sky1.png")
this.sky2 = create_sprite("res/clip3/sky2.png")

this.sun = create_sprite("res/clip3/sun.png")
this.eldritch = create_sprite("res/clip3/smallboi.png")
this.big = create_sprite("res/clip3/bigboi.png")

this.backdrop0 = create_sprite("res/clip3/backdrop0.png")
this.backdrop1 = create_sprite("res/clip3/backdrop1.png")
this.backdrop2 = create_sprite("res/clip3/backdrop2.png")
this.backdrop3 = create_sprite("res/clip3/backdrop3.png")

this.text.add(create_sprite("res/clip3/text0.png"))
this.text.add(create_sprite("res/clip3/text1.png"))
this.text.add(create_sprite("res/clip3/text2.png"))
this.text.add(create_sprite("res/clip3/text3.png"))
this.text_times.add(10.0)
this.text_times.add(8.0)
this.text_times.add(6.0)
this.text_times.add(20.0)
this.text_prg = -1
this.text_time = 0.0

this.music = load_sound("res/clip1/music.mp3")

discard play_sound(this.music)

method update(this: CutScene3) =
this.time += dt
this.text_time -= dt
this.cur_time -= dt

renderer.camera.center = vec2f(320, 192)

this.eldritch.position = vec2f(
(sin(this.time * 0.3) + 1.0) * 5.0,
(cos(this.time * 0.4) + 0.5) * 10.0
)

this.sun.position = vec2f(
0.0,
max(200.0 - 200.0 * (this.time / 40.0), 0.0)
)

if this.time > 20.0:
this.backdrop3.tint = vec4f(1.0, 1.0, 1.0, (this.time - 20.0) * 0.2)
this.big.position = vec2f(0.0, max(200.0 - (this.time - 20.0) * 50.0, 0.0))

if this.text_time < 0.0:
inc this.text_prg
if this.text_prg < this.text.len:
this.text_time = this.text_times[this.text_prg]
this.cur_time = 1.0

for i in countup(0, this.text.len - 1):
if i == this.text_prg:
this.text[i].tint = vec4f(1.0, 1.0, 1.0, min(1.0 - this.cur_time, 1.0))
elif i == this.text_prg - 1:
this.text[i].tint = vec4f(1.0, 1.0, 1.0, max(this.cur_time, 0.0))
else:
this.text[i].tint = vec4f(1.0, 1.0, 1.0, 0.0)



method render(this: CutScene3) =
if this.time < 5.0:
renderer.draw(this.sky0)
elif this.time < 10.0:
renderer.draw(this.sky1)
else:
renderer.draw(this.sky2)

renderer.draw(this.sun)
if this.time > 20.0:
renderer.draw(this.big)

renderer.draw(this.eldritch)

if this.time < 5.0:
renderer.draw(this.backdrop0)
elif this.time < 10.0:
renderer.draw(this.backdrop1)
elif this.time < 20.0:
renderer.draw(this.backdrop2)
else:
renderer.draw(this.backdrop2)
renderer.draw(this.backdrop3)

for text in this.text:
renderer.draw(text)
4 changes: 3 additions & 1 deletion src/game/scenes/level4.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import ../entities/physical_object
import ../../engine/base/renderer as rnd
import level

import cutsc3

type Level4Scene* = ref object of Scene
music: WavHandle
musich: AudioHandle
Expand Down Expand Up @@ -57,7 +59,7 @@ method update(this: Level4Scene) =

if this.level.update():
this.musich.pause()
goto_scene(Level4Scene())
goto_scene(CutScene3())

var op = true
for button in this.level.buttons_idx:
Expand Down
7 changes: 4 additions & 3 deletions src/main.nim
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import nimgl/[glfw]
#import game/scenes/intro
import game/scenes/intro
#import game/scenes/level1
#import game/scenes/cutsc1
#import game/scenes/level2
import game/scenes/level3
#import game/scenes/level3
#import game/scenes/cutsc2
#import game/scenes/level4
#import game/scenes/cutsc3

include engine/base

goto_scene(Level3Scene())
goto_scene(IntroScene())


proc update() =
Expand Down

0 comments on commit 705b14d

Please sign in to comment.