A room full of robots. Clicking a robot moves the camera to- and sets focus on- the robot. Moving the camera while it is focused on a moving object will move the camera in relation to the object. Easing isn’t supported at the moment. I’ll see if I can make use of the easing functions on their own instead of within transitions.
There are discontinuities on the edges of the map where sprites will disappear and reappear depending on whether they’ve looped from your perspective. The problem is cosmetic. The objects’ positions in the level are all correct. I’ll have to look into that.
I don’t plan to support 2.5D isometric maps. That would open a whole 'nother can of worms.
I looked at the NES metatiling example link. I’m always amazed by what game designers of the day were able to achieve with such incredibly limited hardware capabilities!
http://www.youtube.com/watch?v=BmgX4wKC9P4
[code]
display.setStatusBar( display.HiddenStatusBar )
local mte = require “MTE.mte”
mte.loadMap(“robotRoomSteep.json”, “json”)
mte.goto({ locX = 12, locY = 11, blockScale = 64 })
local spriteSheet = graphics.newImageSheet(“spriteSheet.png”, {width = 32, height = 32, numFrames = 96})
local touchRobot = function(event)
if event.phase == “ended” then
mte.setCameraFocus(event.target)
mte.moveCameraTo({object = event.target, time = 30})
end
end
local robots = {}
–CREATE 100 ROBOTS, SET ANIMATIONS, ETC
for i = 1, 100, 1 do
local locX = math.random(9, 41)
local locY = math.random(9, 21)
local layer = mte.getSpriteLayer(mte.getVisibleLevel(locX, locY))
local setup = {kind = “sprite”, layer = layer, locX = locX, locY = locY, sourceWidth = 32, sourceHeight = 32}
local options = {
imageSheet = spriteSheet,
sequenceData =
{
{name = “walkUp”, sheet = spriteSheet, frames = {85, 86}, time = 500, loopCount = 0},
{name = “walkDown”, sheet = spriteSheet, frames = {49, 50}, time = 500, loopCount = 0},
{name = “walkLeft”, sheet = spriteSheet, frames = {61, 62}, time = 500, loopCount = 0},
{name = “walkRight”, sheet = spriteSheet, frames = {73, 74}, time = 500, loopCount = 0}
},
xScale = mte.findScale(32, layer),
yScale = mte.findScale(32, layer)
}
robots[i] = mte.addObject(setup, options)
local direction = math.random(1, 4)
if direction == 1 then
robots[i]:setSequence(“walkUp”)
robots[i]:play()
robots[i].velX = 0
robots[i].velY = -1 * math.random(4, 8)
robots[i].direction = direction
elseif direction == 2 then
robots[i]:setSequence(“walkRight”)
robots[i]:play()
robots[i].velX = math.random(4, 8)
robots[i].velY = 0
robots[i].direction = direction
elseif direction == 3 then
robots[i]:setSequence(“walkDown”)
robots[i]:play()
robots[i].velX = 0
robots[i].velY = math.random(4, 8)
robots[i].direction = direction
elseif direction == 4 then
robots[i]:setSequence(“walkLeft”)
robots[i]:play()
robots[i].velX = -1 * math.random(4, 8)
robots[i].velY = 0
robots[i].direction = direction
end
robots[i]:addEventListener(“touch”, touchRobot)
end
local velX = 0
local velY = 0
local gameLoop = function(event)
print(“frame”)
mte.moveCamera(velX, velY)
mte.debug() --Displays red on-screen debug values
for i = 1, #robots, 1 do
local tile = mte.getTileProperties({locX = robots[i].locX, locY = robots[i].locY})
if robots[i].layer + 1 <= 14 then
if tile[robots[i].layer + 1].tile ~= 0 then
print(“climb”)
mte.changeObjectLayer(robots[i], robots[i].layer + 2)
end
end
if tile[robots[i].layer - 1].tile == 0 and robots[i].layer >= 4 then
print(“fall”)
mte.changeObjectLayer(robots[i], robots[i].layer - 2)
end
mte.moveObject(robots[i], robots[i].velX, robots[i].velY)
end
end
Runtime:addEventListener(“enterFrame”, gameLoop)
[/code] [import]uid: 99903 topic_id: 32457 reply_id: 134664[/import]