Game help :)

i found something that i’d love to use on the forums for a menu but i have no idea how to set up the dependancies… anyone willing tp give me a hand?
ill go grab the url

http://codea.housercompany.com/alpha/index.php?v=712

error: [string “–The name of the project must match your C…”]:17: attempt to get length of global ‘tabs’ (a nil value)
that comes up when i run it… any idea of what im doing wrong?

wait do i run the code through the project with the menu code or the project with the game code and in which one do I do the tick

nvm i asked under the thread to see if the thread maker can assist

In the game, there is a spaceship you control by touching which side of the screen you want it to head towards. Is there a way so that when the spaceship gets off the screen to the right it appears on the left and vice verca?

if ship.x > WIDTH + ship.width then
    ship.x = -ship.width
elseif ship.x < -ship.width then
    ship.x = WIDTH + ship.width
end

ship.width should be the width of the ship’s sprite.

thanks

oh how do i set the ship width

sprite(Shipimagehere,x,y,shipwidth,shipheight)

@SkyTheCoder, why wouldn’t you just do ship.width, ship.height = spriteSize(ship.texture) ?

@OwenClaxton, please read the online help before posting questions, and have a look at some of the demo projects and tutorials before you attempt your own. The forum can’t teach you Codea from the ground up.

@OwenClaxton

local w, h = spriteSize(ship.texture)
ship.width = w

@JakAttak I could have… I didn’t for some reason. I think because I only needed the width. I don’t know…

error: [string " hero = nil…"]:61: attempt to index global ‘enemies’ (a nil value)
what does that mean :stuck_out_tongue:
i’ve been messing around for ages trying to fix it but i dont want to post the full game code cause its my assesment for school, if you can translate that into english without it please respond. elsewise i will consider posting it

It means the variable ‘enemies’ has no value or type, you may have not set the variable correctly or it isn’t predefined or you simply need to put an if statement to check if it isnt nil. It is on line 61.

@OwenClaxton Depending on what you are trying to do, you could put

if hero ~= nil then
--Your original code here
end

thanks! fixed the problem, continuing work on a menu

weird…
i have a variable that toggles if the game is playing or not.
i made it so if you touch the screen it sets it to game_playing.
i tried it out and my game froze

i have given up on a menu :stuck_out_tongue:
if anyone knows of a really easy one I can download and its easy to set up link plz? :slight_smile: