diff --git a/GameEngine/resources/GameEngineTest.model b/GameEngine/resources/GameEngineTest.model index c0e02a7..40a3d27 100644 --- a/GameEngine/resources/GameEngineTest.model +++ b/GameEngine/resources/GameEngineTest.model @@ -1,4 +1,36 @@ init { +scene := { + "entities": { + "1": { + "eid": "1", + "transform": { + "rotation": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "position": { + "x": 570.0, + "y": 321.0, + "z": 0.0 + } + }, + "move": { + "type": straight, + "speed": 5.0 + }, + "mesh": { + "sprite": "GameEngine/resources/enemy1.png", + "type": "sprite" + } + } + } +} player := { "transform": { "rotation": { @@ -36,11 +68,15 @@ "z": 1.0 }, "position": { - "x": 600.0, - "y": 450.0, + "x": 570.0, + "y": 321.0, "z": 0.0 } }, + "move": { + "type": straight, + "speed": 5.0 + }, "mesh": { "sprite": "GameEngine/resources/enemy1.png", "type": "sprite" @@ -75,10 +111,10 @@ native channel EntityPositionUpdate(eid:Str) { in scene.entities.{eid:Str}.transform.position(curPos:Json,updatePosition(nextPos.x,nextPos.y,nextPos.z)) = nextPos } -channel MoveEnemy1(eid:Str) { +channel MoveEnemy1 { in enemy1.transform.position(curPos:Json,moveEnemy1(nextPos,eid)) = nextPos ref enemy1.eid(eid,moveEnemy1(nextPos,eid)) - out enemy1.transform.position(curPos:Json,moveEnemy1(nextPos,eid)) = nextPos + 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 @@ -88,8 +124,8 @@ } channel UpdateEnemy1(tid:Str) { in timers.{tid:Str}.count(curCount:Long,updateEnemy1(type,speed)) = nextCount - ref enemy1.move.speed(speed:Float,updateEnemy1(type,speed)) 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), @@ -108,10 +144,10 @@ native channel TimersUpdated { in timers(curTimers:Map,update(curTimers,nextTimers)) = nextTimers } -channel RotateEnemy1(eid:Str) { +channel RotateEnemy1 { in enemy1.transform.rotation(curRot:Json,rotateEnemy1(nextRot,eid)) = nextRot ref enemy1.eid(eid,rotateEnemy1(nextRot,eid)) - out enemy1.transform.rotation(curRot:Json,rotateEnemy1(nextRot,eid)) = nextRot + out scene.entities.{eid:Str}.transform.rotation(curRot:Json,rotateEnemy1(nextRot,eid)) = nextRot } native channel CameraPositionUpdate { in scene.camera.transform.position(curPos:Json,updatePosition(nextPos.x,nextPos.y,nextPos.z)) = nextPos