Sorry for the horrible title, I didn't know how to explain it.
I'm trying to make it so a entity(that randomly spawns) moves to another randomly generated x and y position, but for some reason, it's only shifting to the X position, not the Y
Also, how can I get it so that the entity moves slower?
Entity moving to a x position, not a y
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Entity moving to a x position, not a y
- Attachments
-
- Game Help.love
- (480.23 KiB) Downloaded 140 times
Re: Entity moving to a x position, not a y
I can't figure out what your problem is exactly, or how to recreate it, could you elaborate on that?
Right, so, first of all your game is packaged incorrectly. I'm not sure if it's because you used gzip compression or not, or whether you packaged a folder. See Game Distribution for that.
I'm not sure what the creator of that font was thinking, but you should definitely not use it. It is far too large and is subsequently slow to load (1024+KB, most fonts are ~15KB). Honestly, I cannot stress how terrible this font is.
Your conf.lua currently does nothing. It needs to be in the root project directory (he's best friends with main.lua). If you're not using it, you may want to add t.love.physics = false to that too.
You can save yourself a lot of effort by creating your tables differently. Currently you're doing this:
You could do it like this:
The latter example is much cleaner (in my opinion) and saves a lot of repetitive typing/tab-completing.
As for moving the image slowly..... that's just a case of adjusting its position by smaller values? Not really sure what you mean here (I must be interpreting the question wrong?).
You also might want to look into object libraries (I recommend slither) or lua metatables so that you can re-use these table structures easily.
Right, so, first of all your game is packaged incorrectly. I'm not sure if it's because you used gzip compression or not, or whether you packaged a folder. See Game Distribution for that.
I'm not sure what the creator of that font was thinking, but you should definitely not use it. It is far too large and is subsequently slow to load (1024+KB, most fonts are ~15KB). Honestly, I cannot stress how terrible this font is.
Your conf.lua currently does nothing. It needs to be in the root project directory (he's best friends with main.lua). If you're not using it, you may want to add t.love.physics = false to that too.
You can save yourself a lot of effort by creating your tables differently. Currently you're doing this:
Code: Select all
soldier = {}
soldier.x = 100
soldier.y = 100
soldier.life = 6
soldier.name = "Isperia"
card.draw = function()
love.graphics.rectangle("fill", soldier.x, soldier.y, 16, 16)
end
--draw call
soldier.draw()
Code: Select all
soldier = {
x = 100,
y = 100,
life = 6,
name = "Isperia",
draw = function(self)
love.graphics.rectangle("fill", self.x, self.y, 16, 16)
end
}
--draw call
soldier:draw()
As for moving the image slowly..... that's just a case of adjusting its position by smaller values? Not really sure what you mean here (I must be interpreting the question wrong?).
You also might want to look into object libraries (I recommend slither) or lua metatables so that you can re-use these table structures easily.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
Who is online
Users browsing this forum: Ahrefs [Bot] and 4 guests