cool thanks, I will take you up on that offer
Here’s what I’ve got so far…
- It’s a stacker game. you’ve got to line the aliens up within the red boundary lines.
- When you hit the space bar, Aliens within the boundary stay put
- The ones outside the boundary breakoff and head toward the bottom of the screen
- The boundaries are determined by how many aliens you kept within them on the previous turn
- If you’ve gone through all the aliens in the pool, the ones on the block are destroyed and added to your score.
This is a mini-game so I want to get the position of aliens at the bottom of the screen (the runaways), store their positions in a table in a module, then when the standard game is reloaded which happens when you empty the alien pool, I want to spawn a commensurate number of runaway aliens there in the same positions. Everything seems to be working ok except for the getting the positions of the runaways. Here’s the last test that I ran, which seems typical of the results that I’ve been getting (stuff inside parentheses are annotations to explain what is happening, or at least what I think is happening) …
(I have a function that sets up the next wave, there were 2 aliens in this wave)
DEBUG:SCRIPT: stacker, control, alien_setup, line 27, pprint, wave…
DEBUG:SCRIPT:
{
1 = hash: [/instance15],
2 = hash: [/instance20],
}
(those 2 feel outside the boundaries and are added the runaway table)
DEBUG:SCRIPT: adding alien to runaway array hash: [/instance15]
DEBUG:SCRIPT: adding alien to runaway array hash: [/instance20]
DEBUG:SCRIPT: stacker, after redirect loop, line 133 runaways 6
DEBUG:SCRIPT:
(this is now all the aliens in the runaway table)
{
1 = url: [stacker:/instance10#alien],
2 = url: [stacker:/instance11#alien],
3 = url: [stacker:/instance15#alien],
4 = url: [stacker:/instance18#alien],
5 = url: [stacker:/instance15#alien],
6 = url: [stacker:/instance20#alien],
}
(no more aliens are left in the wave table)
DEBUG:SCRIPT: stacker, control, input, wave should have runaways removed, line 151…
DEBUG:SCRIPT:
{
}
(Mini game is coming to an end because there’s no more aliens in the pool. Just checking that the runaways table is still the same as last time we saw it, and that we haven’t deleted any of its aliens while we’ve been messing with other tables. It looks the same)
DEBUG:SCRIPT: input, end mini-game, runaways, pprint line 232…
DEBUG:SCRIPT:
{
1 = url: [stacker:/instance10#alien],
2 = url: [stacker:/instance11#alien],
3 = url: [stacker:/instance15#alien],
4 = url: [stacker:/instance18#alien],
5 = url: [stacker:/instance15#alien],
6 = url: [stacker:/instance20#alien],
}
(enter the for loop from my initial post, to try to get positions of runaways. Just getting the p.y on the test run, because I wasn’t sure if vectors can stored in a standard lua file. We get the first two positions. Then it crashes. Still can’t figure out why… )
DEBUG:SCRIPT: stacker, input, runaway, position: 580
DEBUG:SCRIPT: stacker, input, runaway, position: 600
ERROR:SCRIPT: /stacker_game/controller.script:238: Instance (null) not found
stack traceback:
[C]: in function ‘get_position’
/stacker_game/controller.script:238: in function </stacker_game/controller.script:97>