I recently started playing around with Love. I come from more of a backend coding background, PHP and NodeJS sort of stuff, and I've never coded a game before. (I did used to do Quake mods, many many years ago)
A friend and I decided to work on a game together, so a bit of research later and I found Simple Tiled Implementation and the basic "top down rpg" tutorial: https://github.com/karai17/Simple-Tiled ... -to-sti.md
I used this to get my "engine" (such as it is) loading maps made in Tiled, and I figured out enough from just reading docs and examples that I figured out how to scroll the map around the viewport. My question for you folks is... how do I get a sprite into my map that collides with the tiles I choose, is affected by gravity, and can move and jump? I'm rendering a map and moving the "camera" so I seem to be moving in a good direction, but I find the STI docs a bit opaque and am having trouble finding good examples.
I used to do QuakeC, so movement physics aren't completely alien to me, so with that in mind, what do you folks suggest? Where do I start? How do I get a sprite spawned, accelerating downwards when there's nothing under it, and how do I identify what kinda tile is under its feet?
Thanks in advance for helping a noob learn the ropes.
Code: Select all
-- load simeple tiled implementation library
local sti = require "sti"
-- viewport offsets for now
map_y = 0;
map_x = 0;
function love.load()
-- set viewport
love.window.setMode( 1280, 720, {minwidth=1280, minheight=720} )
-- Load map file
map = sti("assets/1080.lua")
end
function love.update(dt)
--scroll map
if love.keyboard.isDown("up") then
map_y = map_y + 5
end
if love.keyboard.isDown("down") then
map_y = map_y - 5
end
if love.keyboard.isDown("left") then
map_x = map_x + 5
end
if love.keyboard.isDown("right") then
map_x = map_x - 5
end
-- Update world
map:update(dt)
end
function love.draw()
-- Draw world
map:draw(map_x, map_y)
end