Basic platformer WIP - Demo

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
Wesleyyy
Prole
Posts: 4
Joined: Mon Oct 28, 2013 7:08 pm
Location: Netherlands
Contact:

Basic platformer WIP - Demo

Post by Wesleyyy »

Heya,

After experimenting with LÖVE for a while, using Lua knowledge I learned via Roblox, I am now creating a basic platformer. I'm considering following Game Architecture & Design in college next year and so far, I'm liking it.

I tried using ATL and a collision system I found somewhere to build the basics, but I didn't understand either of them. After a few hours of thinking, I build the tile and movement from scratch myself and implementing collision didn't cause too much trouble. I don't have any plans for now, I'm just creating whatever I think fits in the game.

Image

There's only 1 short level I made in Tiled a while ago. The blue pole marks the end of the level. If you can touch it, you win.

** Known bugs:
- When walking to the right, walls don't properly stop you. Instead, they bumb you back and forth.
- Triggers (Jumping springs) only detect the bottom-left pixel.
- When you collect a coin, a sound plays. If you collect another while the sound still plays, you won't hear another sound.
(If there's anyone who would like to help me with the collision/sound, I really appreciate it!)

All feedback and help is much appreciated!

I think I'm in love with LÖVE now :3
Attachments
PublicDemo1.zip
Executable version in case you're using an older version of LÖVE.
(8.31 MiB) Downloaded 213 times
PlatformerWIP.love
Build for LÖVE 0.9.0
(150.58 KiB) Downloaded 310 times
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Basic platformer WIP - Demo

Post by davisdude »

Very nice looking game so far! And welcome to the community! :)

I have some comments on the code:
Starting on line 314 of main.lua, and ending on line 621, you have:

Code: Select all

if MapTile[y][x] == number then
     ...
end
if MapTile[y][x] == number then
     ...
end
I'm pretty sure this slows down the game speed a lot. Instead, use else-if statements! :)

Code: Select all

if MapTile[y][x] == number1 then
     ...
elseif MapTile[y][x] == number2 then
     ...
elseif...
You get the idea.

On line 630 of main.lua:

Code: Select all

if MapEntity[n].visible == true then
can also be

Code: Select all

if MapEntity[n].visible then
It's also a good habit to define arguments in the local space instead of globally (read why here if you want).
And I would highly recommend making a separate player.lua and enemy.lua, etc. files, simply for code cleanliness and manageability. Close to 1,000 lines of code is not something that is easy to edit...

Other than that, the code is very well written, so far as I can tell! :D

The game is also rather playable, considering it is the first!
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
Wesleyyy
Prole
Posts: 4
Joined: Mon Oct 28, 2013 7:08 pm
Location: Netherlands
Contact:

Re: Basic platformer WIP - Demo

Post by Wesleyyy »

davisdude wrote:Very nice looking game so far! And welcome to the community! :)
I have some comments on the code:

...

Other than that, the code is very well written, so far as I can tell! :D
The game is also rather playable, considering it is the first!
Hey, thank you very much!

Would moving the

Code: Select all

if MapTile[y][x] == number1 then
     ...
elseif MapTile[y][x] == number2 then
     ...
elseif...  etc
loop and/or the love.graphics.newQuad() list to a seperate draw.lua file make the game any slower?
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Basic platformer WIP - Demo

Post by Karai17 »

Looking good so far!

Moving them to a new file will not cause any slow down, no.

To fix the "moving right into a wall" bug, before you move the player forward, check to see if his new position will be colliding with the wall. If it is, don't move.

Code: Select all

player:move(x,y)
    local pos = {
        x = player.x + x,
        y = player.y + y
    }

    if not checkCollision(pos) then
        player.x = pos.x
        player.y = pos.y
    end
end
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 4 guests