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)
Collector - Educational Project [WIP]
- Belarusian
- Prole
- Posts: 4
- Joined: Wed Jul 24, 2013 1:49 pm
- Location: Belarus
Collector - Educational Project [WIP]
- Attachments
-
- Collector.love
- Here it is!
- (22.2 KiB) Downloaded 292 times
Re: Collector - Educational Project [WIP]
Looking good, and movement is very nice and smooth. Are you planning to introduce obstacles in the game?
Re: Collector - Educational Project [WIP]
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?
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?
- Belarusian
- Prole
- Posts: 4
- Joined: Wed Jul 24, 2013 1:49 pm
- Location: Belarus
Re: Collector - Educational Project [WIP]
Ummm...No it should not happen. Thanks for ur notice.
- Belarusian
- Prole
- Posts: 4
- Joined: Wed Jul 24, 2013 1:49 pm
- Location: Belarus
Re: Collector - Educational Project [WIP]
No. This game is just a result of a learning curve) I'm ready to start an actuall game.Innocuous wrote:Looking good, and movement is very nice and smooth. Are you planning to introduce obstacles in the game?
- baconhawka7x
- Party member
- Posts: 491
- Joined: Mon Nov 21, 2011 7:05 am
- Location: Oregon, USA
- Contact:
Re: Collector - Educational Project [WIP]
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.
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]
Simple and fun, should it always return me to the menu?
Email: ic4ruz39@gmail.com
- Belarusian
- Prole
- Posts: 4
- Joined: Wed Jul 24, 2013 1:49 pm
- Location: Belarus
Re: Collector - Educational Project [WIP]
Yeah, it should)Mermersk wrote:Simple and fun, should it always return me to the menu?
Re: Collector - Educational Project [WIP]
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.
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.
If you can't fix it, Kill it with fire. ( Preferably before it lays eggs. )
Re: Collector - Educational Project [WIP]
Yo,
I looked at your code really quickly, two things that come to mind :
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?
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 likeAnd in MainCode: 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()
This way you can easily make other enemies that inherit basic functionality from enemy (basic OOP right?) . For example: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
Etc... This is a lua way of making basic OOP.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
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.
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?
Who is online
Users browsing this forum: No registered users and 1 guest