I’m having a bit of a mare here trying to use display groups.
Near the top of my code I’m creating various display groups like thus:
[lua]arena_base = display.newGroup – base of arena (floor, wall etc.)
entities = display.newGroup – food, critter, bombs, enemies etc.
flashystuff = display.newGroup – Particles, explosions etc.
gametext = display.newGroup – Any text to be displayed
arena_top = display.newGroup – Anything that needs to be on top.[/lua]
When the user has clicked the start button it calls the initgame function in which all of the game variables are set up, but when I get to this bit…
[lua]background = display.newImage(“gfx/arena1.png”)
arena_base:insert(background) – Insert into the arena_base display group[/lua]
I get the following error in the terminal
[bash]Runtime error
/Users/home/Desktop/coroner/main.lua:30: attempt to index global ‘arena_base’ (a function value)
stack traceback:
[C]: ?
/Users/home/Desktop/coroner/main.lua:30: in function ‘initGame’
/Users/home/Desktop/coroner/main.lua:20: in function
?: in function <?:214>
[/bash]
Anyone got any ideas what I’m doing wrong?
[EDIT]
Ignore me. I’ve just realised that after days of struggling with this it’s as simple as missing the brackets from the end of the display.newGroup() command. DOH!
Feel free to go about your business, there’s nothing to see here.
[import]uid: 7841 topic_id: 14367 reply_id: 314367[/import]