FCK
This commit is contained in:
@@ -5,9 +5,11 @@
|
||||
"entities": [
|
||||
{
|
||||
"name": "hero",
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
"init": {
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -5,16 +5,20 @@
|
||||
"entities": [
|
||||
{
|
||||
"name": "hero",
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
"init": {
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "testEntity",
|
||||
"position": {
|
||||
"x": 24,
|
||||
"y": 16
|
||||
"init": {
|
||||
"position": {
|
||||
"x": 24,
|
||||
"y": 16
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
{
|
||||
"name": "testScene",
|
||||
"width": 80,
|
||||
"height": 48,
|
||||
"width": 240,
|
||||
"height": 160,
|
||||
"entities": [
|
||||
{
|
||||
"name": "hero",
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
"init": {
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "portal",
|
||||
"position": {
|
||||
"x": 16,
|
||||
"y": 16
|
||||
"init": {
|
||||
"position": {
|
||||
"x": 16,
|
||||
"y": 16
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "testEntity",
|
||||
"position": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
"init": {
|
||||
"position": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { strokeCircle } from "#/engine/Circle";
|
||||
import { strokeCircle } from "#/engine/Circle.ts";
|
||||
import { pointer } from "#/engine/Pointer.ts";
|
||||
import { defineScene } from "#/engine/Scene.ts";
|
||||
import type { Hero } from "#/game/entities/hero/entity.ts";
|
||||
import data from "./data.json";
|
||||
|
||||
const { process, preProcess, linkScenes } = defineScene(data);
|
||||
@@ -8,14 +9,14 @@ const { process, preProcess, linkScenes } = defineScene(data);
|
||||
linkScenes(["fooScene"] as const);
|
||||
|
||||
preProcess((entityInstanceMap) => {
|
||||
const entity = entityInstanceMap.get(data.entities[0].name);
|
||||
const instance = entity!.instances[0];
|
||||
const entry = entityInstanceMap.get("hero")!;
|
||||
const instance = entry.instances[0] as Hero;
|
||||
|
||||
instance.position.x = data.width - 16;
|
||||
instance.position.y = data.height - 16;
|
||||
instance.position.x = data.width - instance.animation.sheet.frameHeight;
|
||||
instance.position.y = data.height - instance.animation.sheet.frameWidth;
|
||||
});
|
||||
|
||||
process((ctx, delta) => {
|
||||
process((ctx, _delta) => {
|
||||
if (!pointer.isDown) {
|
||||
strokeCircle(ctx, {
|
||||
position: pointer.position,
|
||||
|
||||
Reference in New Issue
Block a user