Skip to content

Commit

Permalink
impl: rotate, direction
Browse files Browse the repository at this point in the history
  • Loading branch information
gnlow committed Dec 4, 2023
1 parent 31f4d0f commit da72533
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/Entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,18 @@ export class Entry {
this.locate_x(x, obj)
this.locate_y(y, obj)
}
rotate_relative(angle: number, obj: EntrySprite) {
obj.angle += angle
}
direction_relative(angle: number, obj: EntrySprite) {
obj.direction += angle
}
rotate_absolute(angle: number, obj: EntrySprite) {
obj.angle = angle
}
direction_absolute(angle: number, obj: EntrySprite) {
obj.direction = angle
}

/* 생김새 */
show(obj: EntrySprite) {
Expand Down Expand Up @@ -301,7 +313,7 @@ export class Entry {

/* 계산 */
angle(n: number) {
return n
return Number(n)
}
calc_basic(
a: number,
Expand Down Expand Up @@ -341,9 +353,9 @@ export class Entry {
case "y":
return -target.y + 135
case "rotation":
return target.rotation
return target.angle
case "direction":
throw "Unimplemented: direction"
throw target.direction
case "picture_index":
return target.currentTextureIndex
case "size":
Expand Down
3 changes: 3 additions & 0 deletions src/EntrySprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { Entry } from "./Entry.ts"
export class EntrySprite extends Sprite {
textureIds: string[] = []
currentTextureIndex = 0
direction = 0
scene = ""
isClone = false

Expand Down Expand Up @@ -43,6 +44,8 @@ export class EntrySprite extends Sprite {
x: entity.scaleX,
y: entity.scaleY,
}
//sprite.angle = entity.rotation
//sprite.direction = entity.direction
sprite.scene = scene
project.scenes[scene].addChild(sprite)
return sprite
Expand Down

0 comments on commit da72533

Please sign in to comment.