Hi all! New here, and am so far loving Gideros... just suddenly I have a problem...
Everything worked fine up until just today where I started getting a "function arguments expected near 'function'" error whenever I try to run the game.
If I add "local" before it, I get "function arguments expected near 'local'"
My code:
onMouseUp = function (self, event)
playerMoving = true
print(playerMoving)
end |
I have tried changing it to
function onMouseUp(self, event) |
(with the function name before "function") but that didn't help either.
If I delete that section, I get the same error on the next function.
Everything worked fine before which is strange.
I get the error with simple functions like above, and longer--but still relatively simple-- ones (that worked fine a few hours ago!) like this:
newRect = function(w,h,c)
local shape = Shape.new()
shape:setFillStyle(Shape.SOLID,c, 1)
shape:beginPath()
shape:moveTo(0,0)
shape:lineTo(w,0)
shape:lineTo(w,h)
shape:lineTo(0,h)
shape:endPath()
stage:addChild(shape)
return(shape)
end |
Any help would be most appreciated!
Thanks!
Comments
Do you use latest gideros ? If so does the editor (gideros studio) warns you about the same issue ? It looks like the lua parser is stuck at a point it expects function arguments, so probably after an opening parenthesis. What is the code right before the point where it fails ?
It seems like any function above this bit of code works fine.
Thank you!
EDIT: And, if I remove the block of code I pasted above, everything works fine...
Weird...
Try these...
That code does work exactly the same way and works well. The only reason why I was hesitant to do it any other way is because I am translating from corona and intend on having the ground moving as in the code below. But, I guess it should work the same, if I change it to use Gideros's API...?
From Corona SDK:
Thanks so much!
http://docs.giderosmobile.com/reference/gideros/TileMap#TileMap
https://deluxepixel.com
Thanks!
With a tilemap the entire screen full of tiles is drawn as a single mesh. I personally would use it also for an endless runner.
https://deluxepixel.com
I don't need any complicated tilemaps because there is only one row in a loop.
Thank you for your help!
@SinisterSoft is correct about TileMaps, they are very powerful. Maybe a little more advanced for a new Gideros user so use whatever works for you now but do have a look at them sometime. If you ever saw "Million Tile Engine" for Corona then that's similar to what the Gideros Tilemap class can do :bz
Your updateBlocks() function would take some conversion. I start to remember now just how different Corona is from Gideros
Likes: SinisterSoft
Likes: antix
https://deluxepixel.com
Is there a reason why I can't just (and forgive me if this is a stupid question) have a block (and subsequently the rest of the blocks behind) move to the end of the screen, and when it gets off the edge, jump to the other side and continue?
I am currently using two, and at the moment don't plan on adding more...
Thanks!
@SinisterSoft is just saying Tilemaps are better. For a very simple starter project I'd recommend just going with what you are comfortable with and ramp up to more complex things as you get to grips with Gideros
Likes: SinisterSoft
Likes: antix, SinisterSoft
The example could be optimized further by using TexturePacks and classes which are also really fantastic. I'm sure you will learn about those soon.
In fact I would recommend you get the hang of classes and TexturePacks quickly because later you will use them pretty much exclusively.
Likes: antix