Collector - Educational Project [WIP]

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
Belarusian
Prole
Posts: 4
Joined: Wed Jul 24, 2013 1:49 pm
Location: Belarus

Collector - Educational Project [WIP]

Post 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) :awesome:
Attachments
Collector.love
Here it is!
(22.2 KiB) Downloaded 301 times
User avatar
Innocuous
Prole
Posts: 13
Joined: Thu Jul 11, 2013 12:09 pm

Re: Collector - Educational Project [WIP]

Post by Innocuous »

Looking good, and movement is very nice and smooth. Are you planning to introduce obstacles in the game?
User avatar
Dissident
Prole
Posts: 5
Joined: Mon Jul 01, 2013 6:12 pm

Re: Collector - Educational Project [WIP]

Post 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?
User avatar
Belarusian
Prole
Posts: 4
Joined: Wed Jul 24, 2013 1:49 pm
Location: Belarus

Re: Collector - Educational Project [WIP]

Post by Belarusian »

Ummm...No it should not happen. Thanks for ur notice.
User avatar
Belarusian
Prole
Posts: 4
Joined: Wed Jul 24, 2013 1:49 pm
Location: Belarus

Re: Collector - Educational Project [WIP]

Post 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.
User avatar
baconhawka7x
Party member
Posts: 494
Joined: Mon Nov 21, 2011 7:05 am
Location: Oregon, USA
Contact:

Re: Collector - Educational Project [WIP]

Post 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.
User avatar
Mermersk
Party member
Posts: 108
Joined: Tue Dec 20, 2011 3:27 am

Re: Collector - Educational Project [WIP]

Post by Mermersk »

Simple and fun, should it always return me to the menu?
User avatar
Belarusian
Prole
Posts: 4
Joined: Wed Jul 24, 2013 1:49 pm
Location: Belarus

Re: Collector - Educational Project [WIP]

Post by Belarusian »

Mermersk wrote:Simple and fun, should it always return me to the menu?
Yeah, it should)
User avatar
Zer0
Citizen
Posts: 59
Joined: Sat Oct 06, 2012 9:55 am
Location: Sweden
Contact:

Re: Collector - Educational Project [WIP]

Post 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.
If you can't fix it, Kill it with fire. ( Preferably before it lays eggs. )
User avatar
Nananas
Prole
Posts: 1
Joined: Sun Jul 21, 2013 9:36 am

Re: Collector - Educational Project [WIP]

Post by Nananas »

Yo,

I looked at your code really quickly, two things that come to mind :monocle: :
  • . 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... :ultrashocked: 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 :3
    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 :megagrin:

PS: First post... I need an obey avatar now right?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests