Page 1 of 1

My first demo game,take a look

Posted: Sat Apr 06, 2013 4:49 pm
by buhb11
Please read this before downloading
Hello lovers!
I am happy to announce that my first demo of what i hope its going to become bigger is dont after 3 days of work :)
I want to transform this this into an rpg game where you explore,do quest and fight monsters. I want to point out that i am 15 years old and this is my first serious game after pong,space invaders,some basic but funny platformers where you are a rectangle and chase by some enemies who try to kill ya.
Maybe you might want to look into the source code and tell me if i am doing good or bed all the process involve in the game and maybe give me a score between 1 and 10 for how i am programming .I really dont want to bother anyone with all these steps i am asking from you but i dont gont get any help from a teacher or smth like this.
Thanks you a lote for reading this and for all the replays you gave me in my posts!


Edit:I am working non-stop on this and so far i`ve implemented lots and lots of new things,bugs fixes from yesterday


P.S : Camera sucks but i dont know how to make it better so i am apologize
P.S 2 : I dont know why but jumping is the hardest thing in Love2d to implement,i mean in Java i so easy compare to this :(

Re: My first demo game,take a look

Posted: Sat Apr 06, 2013 6:33 pm
by daviddoran
Hi buhb11. Great work on the game so far.
I used Game Maker a lot when I was your age and you should definitely keep working on the game, experimenting, and learning.

Now I'm fairly new to Lua and LOVE so hopefully other members will give advice too but here goes:

It's a good idea to keep your variables local to the file:

Code: Select all

-- added local
local width = love.graphics.getWidth()
local height = love.graphics.getHeight()
I'd put your requires at the top of the file.
For two reasons: (1) it's good practice (2) if you assign the required module to a variable you'll have access to it in the whole file.
Here's an example of requiring a module into a variable:

Code: Select all

-- require the module and assign it to the variable menu
local menu = require "menu"
-- create our main menu
local mainmenu = menu.new("Main Menu")
-- create our settings menu
local settingsmenu = menu.new("Settings Menu")
Here's what the menu module might look like:

Code: Select all

local Menu = {}
Menu.__index = Menu

function Menu.new(title)
	local self = {title = title}
	setmetatable(self, Menu)
	return self
end

return Menu
You could use this approach to make your modules such as menuState a little cleaner, e.g.

Code: Select all

-- at the top of main.lua
local menustate = require("menuStates").new()
-- in love.draw
menustate:draw(dt)
-- in love.update
menustate:update(dt)
I'd keep love.mousepressed in main.lua and then do something like this:

Code: Select all

function love.mousepressed(x, y, button)
  menustate:mousepressed(x, y, button)
end
This makes it clear what input handling is in your game by looking at main.lua and now you could have multiple menustates receiving mouse presses.

I'm not sure about this piece of code:

Code: Select all

--Fps setter 
local love_timer_sleep = love.timer.sleep -- in s (like >=0.8.0)
if love._version:find("^0%.[0-7]%.") then -- if version < 0.8.0
	-- love.timer.sleep in ms
	love_timer_sleep = function(s) love.timer.sleep(s*1000) end
end

if dt < 1/60 then
	love_timer_sleep(1/60 - dt)
end
Is this to get a fixed timestep? I think the best way to do this is with an accumulator (see viewtopic.php?f=4&t=3673). I'd say redefining love_timer_sleep every time love.update is called is very expensive. What was the thinking there?

In terms of game design and gameplay the first little things that came into my head were:
  • How about drawing a custom mouse cursor icon (maybe one like this one) to make it obvious you've to click the menu
  • You could change the color or size of a menu item when you're hovering over it
  • Gravity isn't too difficult once you get it working. It can be tricky though. I'll have to take a proper look at the code.
  • Try making the clouds float by to give a sense of movement.
Great work so far keep it up!

Re: My first demo game,take a look

Posted: Sat Apr 06, 2013 7:18 pm
by buhb11
daviddoran wrote:Hi buhb11. Great work on the game so far.
I used Game Maker a lot when I was your age and you should definitely keep working on the game, experimenting, and learning.

Now I'm fairly new to Lua and LOVE so hopefully other members will give advice too but here goes:

It's a good idea to keep your variables local to the file:

Code: Select all

-- added local
local width = love.graphics.getWidth()
local height = love.graphics.getHeight()
I'd put your requires at the top of the file.
For two reasons: (1) it's good practice (2) if you assign the required module to a variable you'll have access to it in the whole file.
Here's an example of requiring a module into a variable:

Code: Select all

-- require the module and assign it to the variable menu
local menu = require "menu"
-- create our main menu
local mainmenu = menu.new("Main Menu")
-- create our settings menu
local settingsmenu = menu.new("Settings Menu")
Here's what the menu module might look like:

Code: Select all

local Menu = {}
Menu.__index = Menu

function Menu.new(title)
	local self = {title = title}
	setmetatable(self, Menu)
	return self
end

return Menu
You could use this approach to make your modules such as menuState a little cleaner, e.g.

Code: Select all

-- at the top of main.lua
local menustate = require("menuStates").new()
-- in love.draw
menustate:draw(dt)
-- in love.update
menustate:update(dt)
I'd keep love.mousepressed in main.lua and then do something like this:

Code: Select all

function love.mousepressed(x, y, button)
  menustate:mousepressed(x, y, button)
end
This makes it clear what input handling is in your game by looking at main.lua and now you could have multiple menustates receiving mouse presses.

I'm not sure about this piece of code:

Code: Select all

--Fps setter 
local love_timer_sleep = love.timer.sleep -- in s (like >=0.8.0)
if love._version:find("^0%.[0-7]%.") then -- if version < 0.8.0
	-- love.timer.sleep in ms
	love_timer_sleep = function(s) love.timer.sleep(s*1000) end
end

if dt < 1/60 then
	love_timer_sleep(1/60 - dt)
end
Is this to get a fixed timestep? I think the best way to do this is with an accumulator (see viewtopic.php?f=4&t=3673). I'd say redefining love_timer_sleep every time love.update is called is very expensive. What was the thinking there?

In terms of game design and gameplay the first little things that came into my head were:
  • How about drawing a custom mouse cursor icon (maybe one like this one) to make it obvious you've to click the menu
  • You could change the color or size of a menu item when you're hovering over it
  • Gravity isn't too difficult once you get it working. It can be tricky though. I'll have to take a proper look at the code.
  • Try making the clouds float by to give a sense of movement.
Great work so far keep it up!

Thanks you for replay! Now i am going to make the changes you told me.

Re: My first demo game,take a look

Posted: Sat Apr 06, 2013 7:46 pm
by daviddoran
You're welcome! Just let me know if you'd like more explanation on anything.