Now the camera, no matter where the game object is will show the same spot. Can I get some help?
Here’s the script :
function init(self)
msg.post("camera#Camera", “acquire_camera_focus”)
msg.post(".", "acquire_import_focus")
msg.post(".", "menu")
self.play = 0
-- 0 = none; 1 = rules; 2 = win; 3 = lose; 4 = game; 5 = credits; 6 = menu
-- 7 = dates
self.timer = 0
go.set_position(vmath.vector3(-684, -260, 0))
end
function update(self, dt)
if (self.play == 1) then
go.set_position(vmath.vector3(1244, -200, 0))
local timer = self.timer
self.timer = timer + 1
if (self.timer == 600) then
self.timer = 0
self.play = 4
msg.post("enemy#enemy", "play")
msg.post("player#player", "play")
end
end
if (self.play == 2) then
go.set_position(vmath.vector3(684, 260, 0))
local timer = self.timer
self.timer = timer + 1
if (self.timer == 600) then
self.timer = 0
self.play = 5
end
end
if (self.play == 3) then
go.set_position(vmath.vector3(684, -260, 0))
local timer = self.timer
self.timer = timer + 1
if (self.timer == 600) then
self.timer = 0
self.play = 5
end
end
if (self.play == 4) then
local vec = go.set_position(go.get_position("player"))
local x = vec.x
local y = vec.y
local z = vec.z
if (vec.x > 119) then
x = 120
end
if (vec.x < -119) then
x = -120
end
if (vec.y > 259) then
y = 260
end
if (vec.y < -259) then
y = -260
end
go.set_position(vmath.vector3(x, y, z))
end
if (self.play == 5) then
go.set_position(vmath.vector3(1244, 200, 0))
local timer = self.timer
self.timer = timer + 1
if (self.timer == 600) then
self.timer = 0
self.play = 6
end
end
if (self.play == 6) then
go.set_position(vmath.vector3(-684, -260, 0))
end
if (self.play == 7) then
go.set_position(vmath.vector3(-684, 260, 0))
end
end
function on_message(self, message_id, message, sender)
if (message.id == hash("play")) then
self.play = 1
end
if (message.id == hash("dates")) then
self.play = 7
end
if (message.id == hash("win")) then
self.play = 2
end
if (message.id == hash("lose")) then
self.play = 3
end
if (message.id == hash("menu")) then
self.play = 6
end
end