Search found 134 matches

by Wojak
Tue Mar 04, 2014 7:07 am
Forum: General
Topic: Delay on a loop?
Replies: 28
Views: 16355

Re: Delay on a loop?

how would that change it? isn't dt one every second? So.................. 0.5 - 1 = -0.5 1 - 1 = 0 0 is the same or bigger in each one :P dt is 1/FPS so if you running the game at 1 frame per second dt will be 1 but if you running it with 60 it will be 0,017 and love.update is not called once per s...
by Wojak
Thu Feb 27, 2014 8:11 am
Forum: General
Topic: smooth scrolling 2D game: possible?
Replies: 8
Views: 5245

Re: smooth scrolling 2D game: possible?

LÖVE has ways to limit the number of OpenGL calls by merging multiple images into one so you can have the whole background as 1 image, indestructible world objects as 2 leaving you witch entities that you should not draw if off screen... -canvas: a very easy way, but not supported on all systems -sp...
by Wojak
Wed Feb 26, 2014 9:55 am
Forum: General
Topic: What techniques that everyone should know?
Replies: 75
Views: 23037

Re: What techniques that everyone should know?

One question, though. According to the Lua documentation, pairs would traverse a table in an unpredictable manner. This is true for dict-tables. But is it guaranteed that, no matter what the Lua implementation is, pairs will just behave like ipairs when given a Lua array ? Even if there is no guara...
by Wojak
Wed Feb 26, 2014 9:44 am
Forum: General
Topic: What techniques that everyone should know?
Replies: 75
Views: 23037

Re: What techniques that everyone should know?

Also, it uses too many variables - 'i', 'countT' and 'countA' work almost the same way. Here's an implementation that uses the same principle that you're using (increasing an integer to check each key), with less variables, and with the false values bug fixed: function isArray(t) local i = 0 for _ ...
by Wojak
Wed Feb 26, 2014 7:39 am
Forum: General
Topic: What techniques that everyone should know?
Replies: 75
Views: 23037

Re: What techniques that everyone should know?

This is an implementation without #: function isArray(tab) local countT = 0 local countA = 0 local i = 1 for k,_ in pairs(tab) do countT = countT + 1 if tab[i] then countA = countA + 1 end if countT ~= countA then return false end i = i + 1 end return true end And this is a duel between # and no#: t...
by Wojak
Tue Feb 25, 2014 11:22 am
Forum: General
Topic: What techniques that everyone should know?
Replies: 75
Views: 23037

Re: What techniques that everyone should know?

Inverting an array – useful if you have an array that don't change to often, but you need to check it's content very often: local isValidOryginal = {'text1','text2','text3'} locla isValid = {} for i=1, # isValidOryginal do -- every time isValidOryginal changes (once if it never changes) isValid[isVa...
by Wojak
Fri Feb 21, 2014 9:13 am
Forum: General
Topic: Beginner Coding Problem 2
Replies: 9
Views: 4687

Re: Beginner Coding Problem 2

oryginal code: function love.update( dt ) cooldown = cooldown - dt if love.keyboard.isDown("z") and lumber > 49 and cooldown < 0 then if smallshackCounter == 1 then lumber = lumber - 50 smallshackCounter = smallshackCounter + 1 -- smallshackCounter = 2 pop = pop + 3 smallshack2State = &quo...
by Wojak
Thu Feb 13, 2014 6:11 am
Forum: General
Topic: Beginner Coding Problem 2
Replies: 9
Views: 4687

Re: Beginner Coding Problem 2

The easy way: function love.keypressed(key) if key == "z" then if lumber >= 50 then if smallshackCounter == 1 then smallshack2State = "drawn" lumber = lumber - 50 smallshackCounter = smallshackCounter + 1 pop = pop + 3 end end if smallshackCounter == 2 then smallshack3State = &qu...
by Wojak
Fri Feb 07, 2014 10:30 am
Forum: General
Topic: Window size limit?!
Replies: 3
Views: 2129

Re: Window size limit?!

What I have done thus far was simply creating a Window with the size of the atlas I wanted, drew the tiles on it, and then saved a "screenshot" (actually a window dump) to disk (using LÖVE's "screenshot" function). As I said, that worked well.. until now. I was planing to use a ...
by Wojak
Sat Jan 11, 2014 9:14 pm
Forum: Libraries and Tools
Topic: Experiment: LÖVE-olution (an evolution simulator)
Replies: 6
Views: 2929

Re: Experiment: LÖVE-olution (an evolution simulator)

Is the optimal path (yellow) simply the path the fastest entity took? Looks like it.... Yes, the blue one is optimal and the yellow is the best thing evolution has come up with... That said, it's quite a pain to draw the level right now, how about some sort of "generate maze" function, or...