Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

yojimbo2000’s Trench Run & common problem with old downloaded projects

in Code Sharing Posts: 1,799

@yojimbo2000 created a really cool looking Star Wars trench run game thing, see attached screenshot.

It won’t run anymore; attached is a zip of it.

If anyone can help get it working that would be awesome.

I’ve attached an image of the error. This is a frustrating thing that happens with a lot of things I download: Codea shows an error and claims that a function is a nil value when it’s actually not. It’s right there in the file but Codea doesn’t;t seem to see it. Sometimes it seems like old downloaded projects can’t see class functions. @Simeon, could there be something to that?

Anyway, if you want to see it run a little bit, copy and paste this installer into a new project:

local url = "" local function install(data) --parse plist into list of tab files local array = data:match("<key>Buffer Order</key>%s-<array>(.-)</array>") local files = {} for tabName in array:gmatch("<string>(.-)</string>%s") do table.insert(files, {name = tabName}) end --success function local function success(i, name, data) if not data then alert("No data", name) return end print("Loaded "..i.."/"..#files..":" files[i].data = data for i,v in ipairs(files) do if not then return --quit this function if any files have mssing data end end --if all data is present then save... for i,v in ipairs(files) do saveProjectTab(, print("Saved "..i.."/"..#files..":" end for i,v in ipairs(files) do --load... load( end setup() --and run end --request all the tab files for i,v in ipairs(files) do http.request(".lua", function(data) success(i,, data) end, function(error) alert(error," not found") end) end end http.request(url.."Info.plist", install, function (error) alert(error) end)

It will run a little and then crash, but as soon as you exit to the editor it won’t fully run again ever.



  • SimeonSimeon Admin Mod
    Posts: 5,778

    That is really cool. The main problem with the attached project is that some of the tabs are out of order (move Mesh to near the start, after Main). And then for some reason the assets are not being created correctly, specifically the laser bolts aren't being generated. If you go into the Player class and comment out the line which creates a Bolt on touch (starts Bolt{...) it will run, but you can't see the shots

    This seems to be due to a problem with how it tries to load/build assets using a coroutine

  • Posts: 1,799
    @Simeon using the tried and true debugging-by-print-statements method I trace the problem to the line “local m = matrix():rotate(180):rotate(55, 1,0,0)” on the assets tab.

    A print statement put after that line will never print.
  • Posts: 1,799
    If you change that line to just “local m = mesh()” the project runs.

    But it’s kind of funny because none of the laser blasts are pointed the right direction.
  • Posts: 1,799
    Curiouser and curiouser: it also runs if you change the line to `local m = matrix():rotate(55,1,0,0)`, and the laser blasts point the right direction mostly, it’s just that your own blasts point towards you, not away from you.

    But it’s much better!

    Something in Codea is freaking out about `matrix():rotate(180)`
  • SimeonSimeon Admin Mod
    Posts: 5,778

    Try replace the rotate(180) with rotate(180, 0,0,1). Looks like our bug

  • Posts: 1,799
    @Simeon now it works! Awesome. Fun to see this old project run.

    Attached zip file has fully working game.
Sign In or Register to comment.