import { Aseprite } from "../Aseprite" ; import { asset } from "../Assets" ; import { Conversation } from "../Conversation" ; import conversation from "../../assets/dialog/superthrow.dialog.json" ; import { entity } from "../Entity" ; import { GameScene } from "../scenes/GameScene" ; import { NPC } from "./NPC" ; import { RenderingLayer } from "../Renderer" ; @ entity ( "superthrow" ) export class SuperThrow extends NPC { @ asset ( "sprites/superthrow.aseprite.json" ) private static sprite : Aseprite ; private floatAmount = 4 ; private floatSpeed = 2 ; public constructor ( scene , x , y ) { super ( scene , x , y , 18 , 22 ) ; this . lookAtPlayer = false ; this . conversation = new Conversation ( conversation , this ) ; } public getInteractionText ( ) { if ( ! this . met ) { return "Touch" ; } else { return "Talk" ; } } public draw ( ctx ) { const floatOffsetY = Math . sin ( this . timeAlive * this . floatSpeed ) * this . floatAmount ; this . scene . renderer . addAseprite ( SuperThrow . sprite , "idle" , this . x , this . y - floatOffsetY , RenderingLayer . ENTITIES , this . direction ) ; if ( this . scene . showBounds ) { this . drawBounds ( ) ; } this . speechBubble . draw ( ctx ) ; } public update ( dt ) { super . update ( dt ) ; this . speechBubble . update ( this . x , this . y ) ; } }