Masai WIP - the birth of a platformer

Show off your games, demos and other (playable) creations.
User avatar
Cantide
Prole
Posts: 10
Joined: Mon Jul 25, 2011 7:01 pm

Masai WIP - the birth of a platformer

Post by Cantide »

Hi!!

This is my first post on the forum, although I've been trolling IRC for a week or two now, so I'll try not to 'iterate' anyone :)
I've started a simple platformer which will revolve around jumping, and will be mostly vertical.
I'm using love.physics a lot.
I've yet to figure out how to manage my code when it gets a little bigger, so levels / level design will follow when I get that figured out >.<

use 'a' and 'd' to move left and right, and 'space' to jump.
right click to throw a spear - (difficult to master...)
left click to jab - (a little faulty...)

the attacks seem to bug out if you're in the air and you aim down 30 degrees or so... maybe a handy exploit? u_u

A thousand thanks to everyone on IRC for helping me with my horrible mathematics :D Without your help, I wouldn't have gotten this far!

http://dl.dropbox.com/u/36318710/masai.love
Attachments
masai.love
Working spear, parallax backgrounds
(195.65 KiB) Downloaded 191 times
masai.love
Just in case my dropbox link isn't working, although this file may be outdated ( i'm too lazy to log in all the time and edit this post )
(75.4 KiB) Downloaded 161 times
Last edited by Cantide on Sat Aug 13, 2011 7:35 am, edited 14 times in total.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Masai game - the birth of a platformer

Post by nevon »

It seems the player loses momentum as soon as they land. That may be realistic, but it doesn't feel very "platformery".
User avatar
Cantide
Prole
Posts: 10
Joined: Mon Jul 25, 2011 7:01 pm

Re: Masai game - the birth of a platformer

Post by Cantide »

nevon wrote:It seems the player loses momentum as soon as they land. That may be realistic, but it doesn't feel very "platformery".
I know, it actually 'bugs' me quite a bit! I'm not quite sure how to fix it though. It's got to do with the physics. The player bounces slightly, and can't move as quickly until the collision with the ground persists, i.e. he stops bouncing.
If anyone can fix this, please let me know :D

I'm also aware of the fact that you can 'climb' the grey platforms by tapping jump while the collision persists. This is a rather handy bug, which could be done away with with some better level design.

These aren't bugs, they're unintentional features! ^^;;;
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Masai game - the birth of a platformer

Post by slime »

Cantide wrote:These aren't bugs, they're unintentional features! ^^;;;
You are a true programmer. :P
User avatar
Ensayia
Party member
Posts: 399
Joined: Sat Jun 12, 2010 7:57 pm

Re: Masai game - the birth of a platformer

Post by Ensayia »

Hey, you finally made it to the forums!

Yeah, the physics are a bit wonky but I'm sure you can adjust that. Making collision and physics play nice without Box2D is HARD. I hope you have fun building your game!
User avatar
Cantide
Prole
Posts: 10
Joined: Mon Jul 25, 2011 7:01 pm

Re: Masai game - the birth of a platformer

Post by Cantide »

Thanks must go to bartbes for pointing out that I should use a restitution of 0 for both the player and the ground if I want to eliminate the bounce.
Still, I think it's a handy effect for different surface types like mud. I'll implement it later when I actually get that far :p
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Masai game - the birth of a platformer

Post by Tesselode »

What's with the awkward control scheme?
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Masai game - the birth of a platformer

Post by tentus »

Tesselode wrote:What's with the awkward control scheme?
WASD+Space, sans the WS.

I like what you've started Cantide. Some tips:

Code: Select all

    if (b == "player") then
       if (a == "static") then
can be:

Code: Select all

if b == "player" and a == "static" then
function love.keypressed() should generally be outside of love.load, though I suppose it works to have it in there.

Code: Select all

  if facing == "right" then
    love.graphics.draw(masai_torso, objects.ball.body:getX(), (objects.ball.body:getY() - 20), 0,  1, 1,  10, ypos_torso);
    love.graphics.draw(masai_head,  objects.ball.body:getX(), (objects.ball.body:getY() - 25), 0,  1, 1,  0, ypos_torso);
    love.graphics.draw(masai_foot,  objects.ball.body:getX(), (objects.ball.body:getY()), 0,  1, 1,  3 + xpos_foot1, -8 + ypos_foot1);
    love.graphics.draw(masai_foot,  objects.ball.body:getX(), (objects.ball.body:getY()), 0,  1, 1,  3 + xpos_foot2, -8 + ypos_foot2);
  elseif facing == "left" then
    love.graphics.draw(masai_torso, objects.ball.body:getX(), (objects.ball.body:getY() - 20), 0, -1, 1,  10, ypos_torso);
    love.graphics.draw(masai_head,  objects.ball.body:getX(), (objects.ball.body:getY() - 25), 0,  -1, 1,  0, ypos_torso);
    love.graphics.draw(masai_foot,  objects.ball.body:getX(), (objects.ball.body:getY()), 0,  -1, 1,  3 + xpos_foot1, -8 + ypos_foot1);
    love.graphics.draw(masai_foot,  objects.ball.body:getX(), (objects.ball.body:getY()), 0,  -1, 1,  3 + xpos_foot2, -8 + ypos_foot2);
  end
can be:

Code: Select all

	local ballX, ballY = objects.ball.body:getPosition()
	local facing_sign = 1
	if facing == "left" then
		facing_sign = -1
	end
	love.graphics.draw(masai_torso, ballX, (ballY - 20), 0, facing_sign, 1,  10, ypos_torso)
	love.graphics.draw(masai_head,  ballX, (ballY - 25), 0,  facing_sign, 1,  0, ypos_torso)
	love.graphics.draw(masai_foot,  ballX, (ballY), 0,  facing_sign, 1,  3 + xpos_foot1, -8 + ypos_foot1)
	love.graphics.draw(masai_foot,  ballX, (ballY), 0,  facing_sign, 1,  3 + xpos_foot2, -8 + ypos_foot2)
(You could also just make facing into a signed int (that is to say, 1 or -1), allowing you to skip the if statement for local facing_sign.)

If you change canRun (a boolean) to something like runSpeed (a number) you can remove some if statements and also allow for more options in the future.

Finally, in Lua, you don't need semicolons on the end of lines, or parenthesis in if statements, unless you feel like it makes things easier to read. Saves a bit of typing in the long run and clears up the screen if you leave them out.
Kurosuke needs beta testers
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Masai game - the birth of a platformer

Post by Tesselode »

I think using W to jump would be better, since it's not like you need W and S to move forward and backward. However, that's only if you have to use the mouse to aim the weapon. If it just shoots in 1 or 2 directions, using the arrow keys for movement and one button for shooting would be much better.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Masai game - the birth of a platformer

Post by miko »

Cantide wrote:Hi!!

This is my first post on the forum, although I've been trolling IRC for a week or two now, so I'll try not to 'iterate' anyone :)
Nice start! Please add "quit" option after pressing ESC and/or "q". BTW, this should be the first thing implemented in any game ;)
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests