diff --git a/GameEngine/resources/GameEngineTest.model b/GameEngine/resources/GameEngineTest.model index 40a3d27..53cdc14 100644 --- a/GameEngine/resources/GameEngineTest.model +++ b/GameEngine/resources/GameEngineTest.model @@ -1,8 +1,8 @@ init { scene := { "entities": { - "1": { - "eid": "1", + "3": { + "eid": "3", "transform": { "rotation": { "x": 0.0, @@ -15,13 +15,13 @@ "z": 1.0 }, "position": { - "x": 570.0, - "y": 321.0, + "x": 524.0, + "y": 354.0, "z": 0.0 } }, "move": { - "type": straight, + "type": "straight", "speed": 5.0 }, "mesh": { @@ -54,8 +54,8 @@ "type": "sprite" } } -enemy1 := { - "eid": "1", +enemy3 := { + "eid": "3", "transform": { "rotation": { "x": 0.0, @@ -68,13 +68,13 @@ "z": 1.0 }, "position": { - "x": 570.0, - "y": 321.0, + "x": 524.0, + "y": 354.0, "z": 0.0 } }, "move": { - "type": straight, + "type": "straight", "speed": 5.0 }, "mesh": { @@ -108,30 +108,20 @@ "z": z } } +channel MoveEnemy3 { + in enemy3.transform.position(curPos:Json,moveEnemy3(nextPos,eid)) = nextPos + ref enemy3.eid(eid,moveEnemy3(nextPos,eid)) + out scene.entities.{eid:Str}.transform.position(curPos:Json,moveEnemy3(nextPos,eid)) = nextPos +} native channel EntityPositionUpdate(eid:Str) { in scene.entities.{eid:Str}.transform.position(curPos:Json,updatePosition(nextPos.x,nextPos.y,nextPos.z)) = nextPos } -channel MoveEnemy1 { - in enemy1.transform.position(curPos:Json,moveEnemy1(nextPos,eid)) = nextPos - ref enemy1.eid(eid,moveEnemy1(nextPos,eid)) - out scene.entities.{eid:Str}.transform.position(curPos:Json,moveEnemy1(nextPos,eid)) = nextPos -} native channel CameraProjectionUpdate { in scene.camera.projection(curProj:Json,updateProjection(curProj,nextProj)) = nextProj } native channel CameraScaleUpdate { in scene.camera.transform.scale(curScale:Json,updateScale(nextScale.x,nextScale.y,nextScale.z)) = nextScale } -channel UpdateEnemy1(tid:Str) { - in timers.{tid:Str}.count(curCount:Long,updateEnemy1(type,speed)) = nextCount - ref enemy1.move.type(type:Str,updateEnemy1(type,speed)) - ref enemy1.move.speed(speed:Float,updateEnemy1(type,speed)) - out enemy1.transform.position(curPos:Json,updateEnemy1(type,speed)) = { - "x": curPos.x, - "y": (curPos.y+speed), - "z": curPos.z -} -} native channel EntitySpriteUpdate(eid:Str) { in scene.entities.{eid:Str}.mesh(curMesh:Json,updateSprite(spritePath:Str)) = { "sprite": spritePath, @@ -141,13 +131,23 @@ native channel EntityScaleUpdate(eid:Str) { in scene.entities.{eid:Str}.transform.scale(curScale:Json,updateScale(nextScale.x,nextScale.y,nextScale.z)) = nextScale } +channel UpdateEnemy3(tid:Str) { + in timers.{tid:Str}.count(curCount:Long,updateEnemy3(type,speed)) = nextCount + ref enemy3.move.speed(speed:Float,updateEnemy3(type,speed)) + ref enemy3.move.type(type:Str,updateEnemy3(type,speed)) + out enemy3.transform.position(curPos:Json,updateEnemy3(type,speed)) = { + "x": (curPos.x+speed), + "y": curPos.y, + "z": curPos.z +} +} native channel TimersUpdated { in timers(curTimers:Map,update(curTimers,nextTimers)) = nextTimers } -channel RotateEnemy1 { - in enemy1.transform.rotation(curRot:Json,rotateEnemy1(nextRot,eid)) = nextRot - ref enemy1.eid(eid,rotateEnemy1(nextRot,eid)) - out scene.entities.{eid:Str}.transform.rotation(curRot:Json,rotateEnemy1(nextRot,eid)) = nextRot +channel RotateEnemy3 { + in enemy3.transform.rotation(curRot:Json,rotateEnemy3(nextRot,eid)) = nextRot + ref enemy3.eid(eid,rotateEnemy3(nextRot,eid)) + out scene.entities.{eid:Str}.transform.rotation(curRot:Json,rotateEnemy3(nextRot,eid)) = nextRot } native channel CameraPositionUpdate { in scene.camera.transform.position(curPos:Json,updatePosition(nextPos.x,nextPos.y,nextPos.z)) = nextPos