|
#1
|
||||
|
||||
|
After many tries to fix a bug I have encountered, and much research, I am no closer to solving this bug then when I started. So I was wondering if anyone had any ideas on how to fix it.
In Pingus, we use two tables, to map our the penguins actions ( one for left movement, and one for right movement). What we do is, compute the penguin's action at a certian pixel ( falling, moving, climbing a hill, turning, ect) and save that result to a table with a indices of the x and y coordinate ( we have tried several ways to write the indices, ranging from strings to numbers). Then if a penguin reaches a coordinates that has already been encountered, we just grab the end result from the table. The problem starts when we attempt to use abilities such as the digger or miner(we have also re-routed the ability's code to use the walker's code which has not crashed yet, but it still crashes). If we try to assign a value to a table (ie: record_table[tostring(p.x) .. "_xpos" .. tostring(p.y) .. "_ypos"] = "falling") or reading from the table (ie: if record_table[corrdiante_string] == nil) then the player will crash, with the error: "attempt to call a nil value". The game also doesnt crash for every coordinate, so the digger will work for a random amount of time, then that error occurs. here is a basic sample of the code we use: Code:
function memoize_collision_right(x,y,p,ability_effect_value)
local new_value = tostring(x) .. "00" .. tostring(y)
new_value = tonumber(new_value)
if memoize_collision_right_dat[new_value] == nil and p.state ~= "climbing" and p.type ~= "builder" then
if ability_effect_value ~= nil then
table.insert(memoize_collision_right_dat,new_value,ability_effect_value)
else
table.insert(memoize_collision_right_dat,new_value,engine.collision(p))
end
elseif p.state == "climbing" then
engine.collision(p)
end
return memoize_collision_right_dat[new_value]
end
Does anyone have a solution or know why this would happen, our entire project hangs on this bug. Thanks, Jbob & Redwolfhome
__________________
Tools: Playlist Manager , Document to RSS , Notepad++ Instellisense Games/Apps: Asteroids, ZenFrame, Graphing Calculator, Pingus X-Fi2, Boxwars, SkiFree, Jezzball |
| Advertisement | [Remove Advertisement] |
|
|
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 06:34 PM.













Threaded Mode