Search found 74 matches

by surtic
Sun Nov 30, 2008 10:07 pm
Forum: Support and Development
Topic: Support for saving/loading the Lua state?
Replies: 19
Views: 11877

Re: Support for saving/loading the Lua state?

I don't think there's a way to save or load a Lua state, but I'm not sure you have to go that far. If you can represent the state of the game using variables (i.e. you don't need to remember the state of the stack or the program counter) then you can just save and load the content of the variables. ...
by surtic
Sun Nov 30, 2008 3:08 pm
Forum: Support and Development
Topic: Bring back readline!
Replies: 16
Views: 12963

Re: Bring back readline!

Probably the only thing you really get from the config file that you can't do in load() is not opening a window if you don't need one. You could add an optional "config()" function to the script and make sure it runs before you open a window. This would make the code lighter (no need to ma...
by surtic
Sun Nov 30, 2008 12:44 pm
Forum: Support and Development
Topic: Freeze when reading a 102kb file?
Replies: 3
Views: 2139

Re: Freeze when reading a 102kb file?

Don't know what exactly it's choking on, but in line 55 you have a problem: 53 prop_weapon_shotgun = { 54 s_Class = "prop_weapon_shotgun", 55 t_Tracers = table: 01D9C128, 56 s_Base = "prop_weapon", 57 s_AmmoClass = "Shotgun", I get this error message: wrath.txt:55: malf...
by surtic
Sat Nov 29, 2008 1:14 am
Forum: Support and Development
Topic: Contagion
Replies: 12
Views: 14142

Re: Contagion

Eager... yes, you can say that again :shock:
by surtic
Wed Nov 26, 2008 8:35 pm
Forum: Support and Development
Topic: Contagion
Replies: 12
Views: 14142

Re: Contagion

Hi, I'm not sure I fit the perfect profile. I have a lot of programming experience (have been professionally programming for about 12 years, but started when I was about 10...) I've also programmed professionally in Lua. However, I've never programmed a "real game" (I don't call tetris a r...
by surtic
Mon Nov 24, 2008 8:50 pm
Forum: Support and Development
Topic: Making a flashlight
Replies: 12
Views: 8417

Re: Making a flashlight

I'm sure the word 'zombies' was mentioned... :o
by surtic
Mon Nov 24, 2008 4:47 pm
Forum: Support and Development
Topic: Making a flashlight
Replies: 12
Views: 8417

Re: Making a flashlight

Here's some code that does what I think you want: function load() background = love.graphics.newImage("background.jpg") flashlight = love.graphics.newImage("flashlight.png") fw = flashlight:getWidth() fh = flashlight:getHeight() end function draw() local x, y = love.mouse.getPosi...
by surtic
Mon Nov 24, 2008 9:19 am
Forum: Support and Development
Topic: Proper random number generation and radian/degree.
Replies: 22
Views: 25523

Re: Proper random number generation and radian/degree.

Last time it hit me was when I was writing a tetris clone. While debugging, I kept getting the same first block and it really annoyed me. It's true that if you run the program only occasionally (and not too many times in a row) then it doesn't matter - to be honest I've only played it once or twice ...
by surtic
Sun Nov 23, 2008 11:47 pm
Forum: Support and Development
Topic: Moving an object perfectly at an angle
Replies: 10
Views: 5005

Re: Moving an object perfectly at an angle

This code seems to work: function load() angle = 67 x = 100 y = 500 speed = 20 end function update(dt) x = x + math.cos(math.rad(angle)) * dt * speed y = y - math.sin(math.rad(angle)) * dt * speed end function draw() love.graphics.rectangle(love.draw_fill, x, y, 10, 10) end If you use atan2(dy,dx) t...
by surtic
Sun Nov 23, 2008 11:33 pm
Forum: Support and Development
Topic: Can somebody please explain to me setMask?
Replies: 8
Views: 5744

Re: Can somebody please explain to me setMask?

I think the explanation is that a category can be a number between 0 and 15 (i.e. 16 categories). So when you want to specify a list of categories, you can either list them: shape:setCategory(1,3,10) Or you can use a single number to represent this list. To do that, you calculate the sum of 2^catego...