;;; The Inevitable Game ;;; Copyright © 2018 Ricardo Wurmus ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as ;;; published by the Free Software Foundation, either version 3 of the ;;; License, or (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;; General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see ;;; . (define-module (scenes death) #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:use-module (chickadee) #:use-module (chickadee audio) #:use-module (chickadee math rect) #:use-module (chickadee math vector) #:use-module (chickadee render color) #:use-module (chickadee render font) #:use-module (chickadee render texture) #:use-module (chickadee render shader) #:use-module (chickadee render tiled) #:use-module (chickadee scripting) #:use-module (engine assets) #:use-module (engine node) #:use-module (engine node-2d) #:use-module (engine scene) #:use-module (oop goops) #:use-module (config) #:use-module (characters) #:use-module (characters lorenzo) #:use-module (characters reaper) #:export (death)) (define-asset death-map (load-tile-map "assets/maps/death.tmx")) (define-asset vignette-image (load-image "assets/images/vignette.png")) (define-class () (quitting? #:accessor quitting? #:init-form #f) (tile-map #:accessor tile-map #:init-form death-map) (pretend-walking? #:accessor pretend-walking? #:init-form #f)) (define-asset death-font (load-font "assets/fonts/good_neighbors_starling.xml")) (define-asset music-death (load-music "assets/music/death.ogg")) (define texts '("\ Life waits for no one, but death is patient." "\ You have died. Your points don't matter." "\ Death is inevitable." "\ The void resumes." "\ It did not last." "\ You were busy, but none of that matters any more." "\ You were mortal after all." "\ Nobody outruns the clock." "\ Life goes on, but you end here." "\ This is no longer your battle to fight. Let go." "\ Life is hard, but thankfully quite short.")) (define credits '(("The Inevitable Game" "Made by Ricardo Wurmus" "For Lorenzo") ("Sky background" "by Paulina Riva (CC-BY 3.0)") ("Reaper character graphics" "based on \"Lil Reaper Pet\" by Tracy") ("Lorenzo character graphics" "Based on \"Small 3/4 RPG character base\"" "by Stephen Challener (Redshrike)") ("Map tiles" "taken from \"Zelda-like tilesets and sprites\"" "by ArMM1998") ("Food graphics" "taken from \"The Humble Food Pack\"" "by \"The Wise Hedgehog\"") ("Font" "\"Good Neighbors Starling\"" "by PROWNE and Clint Bellanger") ("All music" "composed and recorded" "by Ricardo Wurmus") ("Bird sounds" "taken from the public domain") ("Made with 100% Free Software including" "- GNU Guile" "- Chickadee" "- Guile OpenGL" "- SDL") ("Thanks for enduring this game!"))) (set! *random-state* (random-state-from-platform)) ;; This shader renders the texture after blending each pixel with a ;; 0.1 opacity pixel, thereby rendering everything with increased ;; transparency. (define ghost-shader (delay (strings->shader " #version 130 in vec2 position; in vec2 tex; out vec2 frag_tex; uniform mat4 mvp; void main(void) { frag_tex = tex; gl_Position = mvp * vec4(position.xy, 0.0, 1.0); } " " #version 130 in vec2 frag_tex; uniform sampler2D color_texture; void main (void) { vec4 original = texture2D(color_texture, frag_tex); vec4 g; g = vec4(1, 1, 1, 0.1); g = mix(g, original, 0.5); gl_FragColor = vec4(original.rgb, min(g.a,original.a)); if (gl_FragColor.a < 0.5) { discard; } } "))) (define-method (populate (death )) (cons (let* ((text (list-ref texts (random (length texts)))) (parts (string-split text #\newline))) (make #:name 'top-text #:children (map (lambda (part i) (make