DanielPowerNL

Member
  • Content count

    2
  • Joined

  • Last visited

About DanielPowerNL

  • Rank
    Freshling
  • Birthday 04/11/94

Profile Information

  • Gender
    Man
  1. Thanks for the quick reply! I see now, I wasn't passing the 'name' along to the parent object. I've only been using Lua for a few days now, but I'm absolutely loving it. Until now the only engine I've gotten anywhere with is Game Maker. As a Linux user, I really wanted to find an easy to use alternative that I could develop on Linux. I'm quite glad I found Love2D. I'm planning on spending more time with Lua/Love2D to become more familiar with game logic before I start delving into C++/SFML, which I think will be my next adventure. I put my current code base up on GitHub (this is my first time using GitHub as well, so I hope I'm doing everything correctly with it). https://github.com/DanielPower/zokEngine PS: Thanks for showing me Hastebin. When I opened it, for a second I questioned if it had somehow read my Atom config. Because it looks almost identical to my setup. Looks like a much nicer alternative to pastebin. http://lookpic.com/O/i2/968/C0ZP7En.png
  2. First of all, I'd like to thank you so much for this well written and easy to understand tutorial. After following this I've managed to get a great deal of work done on my first roguelike project in Lua. However, I have one problem I haven't been able to get around, and I'd like to ask your help. I'm trying to setup a constructor for my objects, so that on creation, objects will pass along a message to my debug window. The issue is that if I run self.create in a parent object, it will print the parent's name. However if I run self.create in the parent as well as the child object, I get duplicate messages. I've been unable to get a constructor to run only once, using the data in the class that I am trying to create an object of. Here is my parent object: Object = {} -- Master Class of all objectsfunction Object.new() local self = {} local id = zokEngine.ObjectListAdd(self) local name = "Object" self.getID = function() return id end self.getName = function() return name end self.create = function() zokEngine.print("Object '" .. name .. "' created with id '" .. id .. "'") end if self.step == nil then function self.step(dt) end end if self.draw == nil then function self.draw() end end return selfendAnd here is my child object Body = {}function Body.new(x, y) local self = Object.new() local name = "Body" self.x = x self.y = y self.draw = function() love.graphics.setColor(255, 255, 255, 255) love.graphics.rectangle("fill", player.x, player.y, 32, 32) end return selfendAny help would be greatly appreciated. Thank you again for the tutorial!