File tree Expand file tree Collapse file tree 6 files changed +45
-1
lines changed
Expand file tree Collapse file tree 6 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ import {
1313 switchBaseTexture ,
1414 switchPressedTexture ,
1515 switchTexture ,
16+ tutorialImg1 ,
17+ tutorialImg2 ,
18+ tutorialImg3 ,
1619} from "./resources.ts" ;
1720import type { StageDefinition } from "./stages.ts" ;
1821
@@ -793,6 +796,27 @@ function updateSprite(
793796 sprite . y = y * blockSize + marginY ;
794797}
795798
799+ export function createTutorialSprite (
800+ cx : { _stage_container : Container } ,
801+ order : number ,
802+ ) {
803+ let sprite = new Sprite ( tutorialImg1 ) ;
804+ switch ( order ) {
805+ case 2 :
806+ sprite = new Sprite ( tutorialImg2 ) ;
807+ break ;
808+ case 3 :
809+ sprite = new Sprite ( tutorialImg3 ) ;
810+ break ;
811+ }
812+ sprite . width = 200 ;
813+ sprite . height = 200 ;
814+ sprite . x = 500 ;
815+ sprite . y = 100 ;
816+ cx . _stage_container . addChild ( sprite ) ;
817+ }
818+ //ToDo: 現在の仕様では、Escメニュー表示状態でも動き続ける。
819+
796820export function printCells ( cells : GridCell [ ] [ ] , context ?: string ) {
797821 console . log (
798822 `${ context ? context : "Grid" } :
Original file line number Diff line number Diff line change 11import { Application , Container , type Ticker } from "pixi.js" ;
22import { derived , get , writable } from "svelte/store" ;
33import { Facing } from "./constants.ts" ;
4- import { Grid , createCellsFromStageDefinition } from "./grid.ts" ;
4+ import {
5+ Grid ,
6+ createCellsFromStageDefinition ,
7+ createTutorialSprite ,
8+ } from "./grid.ts" ;
59import * as Player from "./player.ts" ;
610import type { Context , GameState , UIInfo } from "./public-types.ts" ;
711import { bunnyTexture } from "./resources.ts" ;
@@ -138,6 +142,19 @@ export async function setup(
138142 } ) ,
139143 ) ;
140144
145+ // Stage 1,2のチュートリアル表示実装機構
146+ // Frm stands for Frames
147+ let tutorialFrm = 0 ;
148+ app . ticker . add ( ( ticker ) => {
149+ tutorialFrm += ticker . deltaTime ;
150+ // 1秒ごとにチュートリアルの画像が変わる
151+ createTutorialSprite ( cx , Math . floor ( tutorialFrm / 60 + 1 ) ) ;
152+ if ( tutorialFrm >= 180 ) {
153+ tutorialFrm = 0 ;
154+ //Todo: Stage 1,2のみにする
155+ }
156+ } ) ;
157+
141158 cx . dynamic . player = Player . init ( cx , bunnyTexture ) ;
142159 app . ticker . add ( unlessPaused ( ( ticker ) => Player . tick ( cx , ticker ) ) ) ;
143160
Original file line number Diff line number Diff line change @@ -12,3 +12,6 @@ export const highlightTexture = await Assets.load("/assets/highlight.svg");
1212export const highlightHoldTexture = await Assets . load (
1313 "/assets/highlight-hold.webp" ,
1414) ;
15+ export const tutorialImg1 = await Assets . load ( "/assets/tutorial1.png" ) ;
16+ export const tutorialImg2 = await Assets . load ( "/assets/tutorial2.png" ) ;
17+ export const tutorialImg3 = await Assets . load ( "/assets/tutorial3.png" ) ;
You can’t perform that action at this time.
0 commit comments