Cell Factory

Hey! I just recently (Like 5 hours ago) started working on a factory game project, nothing fancy or special about it just another factory game because I love them. The reason I’m not doing anything special with it, (at least nothing planned is cause it will be the first game I’ve ever “made” / “published”. Maybe ill add some cool stuff later on in the project but I need to stop procrastinating and actually make a game lol.

Context: Ive been working on game development / design for as long as I can remember, I love to create things. Ive never finished a game due to me losing motivation to continue, but I have published several (like 70ish) unfished games on a platform called Roblox, now that I’m older I kinda hate Roblox ngl lmao (And I also removed them from the public cause uh… their quality was trash).

I tried to start my degree in programming but I couldn’t stay focused in my classes due to some mental problems so I ended dropping out to try again at a later date. I did learn and pass my Python class though!

Anyway I hope to post updates and such on this game, and hopefully (My main goal) is to get familiar with Defold, and more familiar with the Lua language, to create more and actually good / unique games :smiley: !


This is literally, all I have done in the past 5 freaking hours :smiley: ! My original plan was to have a camera that the user moved to see the map and such, then it developed into having a sprite attached to the camera (With no collisions or anything, so the user could see the center of the cameras view, ran into a crap ton of issues that I couldn’t figure out, the main one being, My, Sprite, Kept, Vanishing, Every, Time, I, Built, The, Project! Then I remembered I didn’t really want a sprite to begin with so I just removed it and sighed at my frustration (Any clues and suggestions for that would help, I don’t really need the sprite but It would be a nice quality of life feature in my opinion.)

And here is the resulting code from that 5 hour struggle :smiley: (More like a 3 hour struggle cause I spent the first hour or two working my way around the editor to learn it, aswell as reading documentations and tutorials!

function init(self)
	local w = tonumber(sys.get_config("display.width"))
	local h = tonumber(sys.get_config("display.height"))
	go.set_position(-vmath.vector3(w/2, h/2, 0), "#cam")
	msg.post("#cam", "acquire_camera_focus")

	msg.post(".", "acquire_input_focus")
	self.vel = vmath.vector3()

function update(self, dt)
	local pos = go.get_position()
	pos = pos + self.vel * dt

	self.vel.x = 0
	self.vel.y = 0

function on_input(self, action_id, action)
	if action_id == hash("up") then
		self.vel.y = 150
	elseif action_id == hash("down") then
		self.vel.y = -150
	elseif action_id == hash("left") then
		self.vel.x = -150
	elseif action_id == hash("right") then
		self.vel.x = 150

Dont get me wrong though, I may get frustrated, BUT THATS THE BEST FREAKING PART! Learning from my mistakes and being able to overcome them / deal with them is the best part about programming in my opinion! I get ecstatic when I can figure out the problem and solve it, less so when I cant and have to switch methods but eh, its part of the process! Also I should mention I absolutely hate watching videos of people teaching my how to code. I learn through throwing myself in and learning as I go, looking up each individual idea I have and how I would implement it, changing code around and teaching myself how things work, its how Ive got the basis of C++, C#, Javascript, Java, and technically Python, I did attend a class for Python but I got way ahead way to fast and I was bored with how slow the teacher was going. I ended up trying to create an AI in python when they were teaching us how to draw shapes :grinning_face_with_smiling_eyes: Then the class ended and I didn’t get to finish it or get back around to it. Oh well.

OkAY, I’m done rambling It got out of control, I would love feedback and suggestions as I move through this project, and if there are any easier ways / better ways to handle something in my code I would absolutely love to hear it! If you read this far, thanks, but why would you read my ramble up till this point lmao.


OH! ALSO! I would love to eventually get to the point to participate in Game Jams! I’ve always wanted to! But not rn, I need more practice programming! (ANd maybe a little artwork practice cause uh, mine currently kinda stink lmao)!

The problem is likely that the sprite ends up outside of the default z-value range of 1 to -1.

The default range can be changed: The render pipeline in Defold

Hey thanks for replying to that, I’m on my phone rn as I’m at work, but I thought the same thing after looking through a couple forum posts, the issue is I had set the z value set properly above the tile map and background and I could see it in the editor, and I didn’t see anything in my code that would change the z value but it just kept vanishing 🥲

The editor will not know which z-range that you have in your render script. So something might be visible in the editor but fall outside of the range when running the game and rendering everything for real.