@@ -5,7 +5,7 @@ import * as consts from "./constants.ts";
55import { Inputs } from "./constants.ts" ;
66import { Block } from "./constants.ts" ;
77import type { AbilityInit , Context } from "./public-types.ts" ;
8- import { highlightHoldTexture , highlightTexture } from "./resources.ts" ;
8+ import { bunnyTexture , characterCtrlTexture , highlightHoldTexture , highlightTexture } from "./resources.ts" ;
99
1010export function init (
1111 cx : Context ,
@@ -276,12 +276,22 @@ export function tick(cx: Context, ticker: Ticker) {
276276 } ) ;
277277 }
278278
279- if ( cx . dynamic . player . facing === consts . Facing . left ) {
280- if ( ! cx . dynamic . player . sprite ) throw new Error ( "Player sprite is null" ) ;
281- cx . dynamic . player . sprite . scale . x = - 1 * Math . abs ( cx . dynamic . player . sprite . scale . x ) ;
279+ if ( ! player . sprite ) throw new Error ( "Player sprite is null" ) ;
280+
281+ if ( player . facing === consts . Facing . left ) {
282+ player . sprite . scale . x = - 1 * Math . abs ( player . sprite . scale . x ) ;
283+ } else {
284+ player . sprite . scale . x = Math . abs ( player . sprite . scale . x ) ;
285+ }
286+
287+ if ( player . holdingKeys [ Inputs . Ctrl ] ) {
288+ player . sprite . texture = characterCtrlTexture ;
289+ player . sprite . width = consts . playerWidth * blockSize ;
290+ player . sprite . height = ( 32 / 27 ) * consts . playerHeight * blockSize ;
282291 } else {
283- if ( ! cx . dynamic . player . sprite ) throw new Error ( "Player sprite is null" ) ;
284- cx . dynamic . player . sprite . scale . x = Math . abs ( cx . dynamic . player . sprite . scale . x ) ;
292+ player . sprite . texture = bunnyTexture ;
293+ player . sprite . width = consts . playerWidth * blockSize ;
294+ player . sprite . height = consts . playerHeight * blockSize ;
285295 }
286296
287297 // 当たり判定結果を反映する
0 commit comments