Page 1 of 1
Collector - Educational Project [WIP]
Posted: Wed Jul 24, 2013 2:36 pm
by Belarusian
Hi there!
(Sorry for my English. It's not my native language.)
I'm new to programing and love2d in particular) So this is my first attempt)
I want to get some advises and tips about coding and optimization. I will appreciate any help)
Re: Collector - Educational Project [WIP]
Posted: Wed Jul 24, 2013 3:46 pm
by Innocuous
Looking good, and movement is very nice and smooth. Are you planning to introduce obstacles in the game?
Re: Collector - Educational Project [WIP]
Posted: Wed Jul 24, 2013 4:21 pm
by Dissident
Nice. Despite being so simple, it's quite fun.
I had one problem. After collecting all 25 blocks twice, I was in the middle of the third time and it suddenly returned me to the menu. Is that supposed to happen?
Re: Collector - Educational Project [WIP]
Posted: Wed Jul 24, 2013 9:27 pm
by Belarusian
Ummm...No it should not happen. Thanks for ur notice.
Re: Collector - Educational Project [WIP]
Posted: Wed Jul 24, 2013 9:28 pm
by Belarusian
Innocuous wrote:Looking good, and movement is very nice and smooth. Are you planning to introduce obstacles in the game?
No. This game is just a result of a learning curve) I'm ready to start an actuall game.
Re: Collector - Educational Project [WIP]
Posted: Wed Jul 24, 2013 10:17 pm
by baconhawka7x
Wow, this game is a lot of fun! The art is good, and I like how the background color changes so often, it makes the game feel very fast paced.
I also really like the way the player bounces off of the walls instead of just stopping at them. it really fits with this type of game.
Re: Collector - Educational Project [WIP]
Posted: Thu Jul 25, 2013 3:53 am
by Mermersk
Simple and fun, should it always return me to the menu?
Re: Collector - Educational Project [WIP]
Posted: Thu Jul 25, 2013 1:44 pm
by Belarusian
Mermersk wrote:Simple and fun, should it always return me to the menu?
Yeah, it should)
Re: Collector - Educational Project [WIP]
Posted: Fri Jul 26, 2013 11:07 am
by Zer0
You asked about improving performance, and I got one thing.
SpriteBatches, I would use them in any fast paced game ( or anything that is just not a proof of concept really ) that uses a for loop to draw things.
with this few things being drawn every frame its no big deal, but if you would have to draw... say 60000 tiles every frame ( If you could fit that many on the screen ) it would really help with a SpriteBatch.
Other than that it was fun playing, and the mechanics worked as they should.
Re: Collector - Educational Project [WIP]
Posted: Fri Jul 26, 2013 6:16 pm
by Nananas
Yo,
I looked at your code really quickly, two things that come to mind
:
- . you use different images for the right and left facing marine... Maybe use scale (as in 1 and -1) for that.
. That Object Oriented approach of yours seems a bit off, if that is what you where going for anyway. If not, then just ignore the next part... When making more complicated objects, i think your way of doing the update and draw code of multiple objects will hinder you later on. Instead, it can (probably) be easier to go for a more "correct" OOP way: something like
Code: Select all
function Enemy.Load()
local e = {}
setmetatable(e, {__index = Enemy}) -- now the table "e" becomes an Enemy
--your enemy load stuff here
e.doAFlip = true
...
return e
end
function Enemy:Update(dt)
self.x = self.x + self.vx * dt
-- etc.
end
-- and the same for Draw()
And in Main Code: Select all
function love.load()
enemies = {}
for i=1,25 do
enemy = Enemy.Load()
table.insert(enemies, enemy)
end
end
function love.update(dt)
for k,e in pairs(enemies) do
e:Update(dt)
end
end
This way you can easily make other enemies that inherit basic functionality from enemy (basic OOP right?) . For example:
Code: Select all
SuperEnemy = {}
function SuperEnemy.Load()
setmetatable(SuperEnemy,{__index = Enemy})
-- this is how SuperEnemy knows he/she has to look up functions/variables in Enemy when he can't find them here
local superenemy = Enemy.Load()
setmetatable(superenemy,{__index = SuperEnemy})
-- and finally linking the instance of enemy we just made with superenemy, giving him extra power or something
-- new superenemy stuff here
return superenemy
end
function SuperEnemy:Update(dt)
--extra superenemy stuff here
Enemy.Update(self,dt)
end
Etc... This is a lua way of making basic OOP.
Of course, if you don't know what I'm talking about, give a shout
Well, another way of doing this is using a library that does all this for you... Though I have not yet used one myself.
This is what I do anyway...
Please correct me if i'm wrong in any way, I am just a layman too
PS: First post... I need an obey avatar now right?