Search found 46 matches
- Sat Jul 18, 2015 10:38 am
- Forum: Support and Development
- Topic: How can I make a Map Editor?
- Replies: 8
- Views: 2261
Re: How can I make a Map Editor?
how can I detect which "tile" the mouse is on, not the x/y but the tile, as the map editor I'm planning to make is gonna have a tilemap.. To convert from screen x/y to map x/y coordinates, you need to divide the screen coordinates by your gridSize. For example, if your grid size is 64 pix...
- Fri Jul 17, 2015 3:17 pm
- Forum: Support and Development
- Topic: "Questions that don't deserve their own thread" thread
- Replies: 905
- Views: 411510
Re: "Questions that don't deserve their own thread" thread
If file2 requires file1, it can see any globals defined by file1. If file3 then includes file2, it can also see any globals defined in file1, because they are globals. But globals are evil, so what you really want is for each file to return the things it's supposed to expose, and explicitly require...
- Fri Jul 17, 2015 2:27 pm
- Forum: Support and Development
- Topic: How can I make a Map Editor?
- Replies: 8
- Views: 2261
Re: How can I make a Map Editor?
Ok I'll try TSerial and Ser and see which suits my needs better, though I have a new problem, how can I detect which "tile" the mouse is on, not the x/y but the tile, as the map editor I'm planning to make is gonna have a tilemap..
- Fri Jul 17, 2015 2:12 pm
- Forum: Support and Development
- Topic: "Questions that don't deserve their own thread" thread
- Replies: 905
- Views: 411510
Re: "Questions that don't deserve their own thread" thread
Just a little question, say there are these lua files, file1, file2 and file3, file2 has require "file1" so file2 can use the functions, variables etc. in file1 then file3 has require "file2", so file3 can also access file1?(as file2 has require "file1") or am I wrong?
- Fri Jul 17, 2015 9:15 am
- Forum: Support and Development
- Topic: Is this a good timer that I made?
- Replies: 4
- Views: 2108
Re: Is this a good timer that I made?
Ok I have put all the necessary functions in a table: local timer = {} local timers = {} local counter = 0 local function checkNumber(n) if type(n) ~= "number" or n < 0 then return false end return true end function timer.Free(idd) for _, t in pairs(timers) do if idd == timer.id then timer...
- Thu Jul 16, 2015 3:43 pm
- Forum: Support and Development
- Topic: Is this a good timer that I made?
- Replies: 4
- Views: 2108
Re: Is this a good timer that I made?
I tried reworking on it, maybe this is better? :? local timers = {} local counter = 0 local function checkNumber(n) if type(n) ~= "number" or n < 0 then return false end return true end function freeTimer(idd) for _, timer in pairs(timers) do if idd == timer.id then timers[timer.id] = nil ...
- Thu Jul 16, 2015 8:29 am
- Forum: Support and Development
- Topic: Is this a good timer that I made?
- Replies: 4
- Views: 2108
Is this a good timer that I made?
So I tried to make a simple timer function, so here's what I made: activeTimers = {} function checkNumber(n) if type(n) ~= "number" or n < 0 then error("[Timer]The delay argument must have a positive number.") end end function timer(delay, func, ...) checkNumber(delay) table.inse...
- Thu Jul 16, 2015 3:48 am
- Forum: Support and Development
- Topic: What are metatables? what is __index, __call ?
- Replies: 2
- Views: 1445
What are metatables? what is __index, __call ?
I'm a bit confused on how to use metatables, how can I use setmetatable, __index, and __call functions? what is their purpose?
and is there a difference between metatable and an ordinary table ?
and is there a difference between metatable and an ordinary table ?
- Thu Jul 16, 2015 3:02 am
- Forum: Support and Development
- Topic: How can I make a Map Editor?
- Replies: 8
- Views: 2261
Re: How can I make a Map Editor?
Well, my game is a tower defense game, the things I'm having problems with is:
1. Grid map
2. Loading a tile map
3. Saving the map
1. Grid map
2. Loading a tile map
3. Saving the map
- Thu Jul 16, 2015 2:01 am
- Forum: Support and Development
- Topic: How can I make a Map Editor?
- Replies: 8
- Views: 2261
How can I make a Map Editor?
I seem to be struggling on this one, I don't know how to make a Map Editor for my game D: anyone can give me some useful tips/help so I can make this?