Discord
Login
Community
DARK THEME

I'm trying to make a 2d platformer and need help with side scrolling

can u help?

  offset = 0
  
  map = ""
  width = 0
  
  constructor = function(properties)
    local property_names = ["map", "width"]
    
    for property in property_names
      if utils.has(properties, property) then
        this[property] = properties[property]
      end
    end
  end
  
  update = function() end
  
  draw = function()
    local offset = offset + width
    
    local half_width = screen.width/2
    
    screen.fillRect((offset - half_width) / 2, 0, offset - half_width, 4, "rgb(0,255,0)")
    local min_distance = offset + half_width
    local min_position = offset - utils.round_to(min_distance, width) - width/2
    
    local max_distance = half_width - offset
    local max_position = offset + utils.round_to(max_distance, width) + width/2
    
    // print([min_position, max_position])
    
    for x=min_position to max_position by width
      screen.drawMap(map, x, 0, width, screen.height)
    end
  end
end ```

Nice to meet you I love fallout too!

heh thanks I played 3 and found a super mutant with only a bb gun because my 10mm ran out. never been so scared in my life.

Dang sorry for you I mainly just like running around with power armor and with energy cores just killing everyone

Post a reply

Progress

Status

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