41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
|
import { drawBackground } from "./jugando";
|
||
|
import { Juego, State as AllState } from "./main";
|
||
|
import * as welcome from "./welcome";
|
||
|
|
||
|
export type State = {
|
||
|
current: "logo";
|
||
|
timeout: number;
|
||
|
};
|
||
|
|
||
|
export function createState(): State {
|
||
|
return {
|
||
|
current: "logo",
|
||
|
timeout: 5 * 1000,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
export function update(juego: Juego<State>, dt: number) {
|
||
|
juego.state.timeout -= dt;
|
||
|
if (juego.state.timeout < 0) {
|
||
|
(juego as Juego<AllState>).state = welcome.createState();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export function draw(juego: Juego<State>, timestamp: number) {
|
||
|
drawBackground(juego, 0, juego.canvas.height, juego.assets.cielo);
|
||
|
drawBackground(juego, 0, juego.canvas.height, juego.assets.parquePublicoRio);
|
||
|
|
||
|
juego.sprites.logoSalvaLaCostaneraGrande.draw(
|
||
|
juego,
|
||
|
juego.canvas.width / 2 -
|
||
|
juego.sprites.logoSalvaLaCostaneraGrande.getWidth(juego) / 2,
|
||
|
juego.canvas.height * 0.1
|
||
|
);
|
||
|
|
||
|
juego.sprites.logoFPGFDTBlanco.draw(
|
||
|
juego,
|
||
|
juego.canvas.width / 2 - juego.sprites.logoFPGFDTBlanco.getWidth(juego) / 2,
|
||
|
juego.canvas.height - 30 - juego.sprites.logoFPGFDTBlanco.getHeight(juego)
|
||
|
);
|
||
|
}
|