Discord
Login
Community
DARK THEME

map

hi

i dont know how place the map so that it is visible in the background and sorry for my English

init = function()
  sprite1 = new Sprite( 20, 20 )
  sprite1.frames[0].setColor( "red" )
  sprite1.frames[0].fillRect( 10, 10, 15, 15 )
  sprites["sprite1"] = sprite1
  map1 = new Map( 25, 5, 10, 30 )
  for y = 0 to map1.height-1 by 1
    for x = 0 to map1.width-1 by 1
      if random.next() > 0.8 then 
        map1.set( x, y, "sprite1")
      end
    end
  end
    
  map2 = new Map( 5, 25, 30, 10 )
  for y = 0 to map2.height-1 by 1
    for x = 0 to map2.width-1 by 1
      if random.next() > 0.8 then 
      map2.set( x, y, "icon")
      end
    end
  end
end

update = function()
end

draw = function()
  screen.clear()
  screen.drawMap( map1, 
    sin(system.time()/987)*10, cos(system.time()/1234)*20, 
    map1.width*map1.block_width, map1.height*map1.block_height )
  screen.drawMap( map2, 0, 0, 
    map2.width*map2.block_width, map2.height*map2.block_height )
end

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community