2021-07-05 15:49:06 +00:00
|
|
|
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",
|
2021-07-06 21:10:48 +00:00
|
|
|
timeout: 10 * 1000,
|
2021-07-05 15:49:06 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function update(juego: Juego<State>, dt: number) {
|
|
|
|
juego.state.timeout -= dt;
|
2021-07-06 21:10:48 +00:00
|
|
|
if (
|
|
|
|
juego.state.timeout < 0 ||
|
|
|
|
juego.mouse.down ||
|
|
|
|
(juego.touches && juego.touches.length > 0)
|
|
|
|
) {
|
2021-07-05 15:49:06 +00:00
|
|
|
(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)
|
|
|
|
);
|
|
|
|
}
|