391
TI-Nspire / Re: [Ndless] nKaruga
« on: May 19, 2014, 01:27:08 pm »
On a more positive note, update !
I've implemented level streams ! That means that enemies can now arrive on-screen in an organized manner, without me having to declare several enemies in the code - a single array of enemies is enough for the whole game, as there will be a definite maximal number of enemies on the screen at once.
The "levels" are scripted, and easy enough to design. Here is the current example level script :
Here, an enemy() instruction adds an enemy to the scene. The prototype is the following :
Next, there's the cmd_killed instruction. It's a level stream command, waiting for every active enemy to be killed or having exited the map before carrying on the level stream. I also implemented the cmd_wait(frames) instruction, whose purpose is obvious, but it's not used yet.
Then, the end of the level stream is marked by LVLSTR_END. When this point is reached, the game waits for every enemies to be killed, then quits - although for now you can't kill enemies so we'll see if that works when I'll implement collisions
Here's a screenshot of the above level stream :
This time, I'll really work on collision detection I just hope it won't slow things too much - although I'm certain that it will.
I've implemented level streams ! That means that enemies can now arrive on-screen in an organized manner, without me having to declare several enemies in the code - a single array of enemies is enough for the whole game, as there will be a definite maximal number of enemies on the screen at once.
The "levels" are scripted, and easy enough to design. Here is the current example level script :
Code: [Select]
int levelStream[] = {
enemy(110, 0, image_LUT_enemy_ship_0_light, image_LUT_enemy_bullet_1_light, callback_LUT_0, LIGHT, 1),
enemy(220, 0, image_LUT_enemy_ship_0_shadow, image_LUT_enemy_bullet_1_light, callback_LUT_0, SHADOW, 1),
cmd_killed,
LVLSTR_END
};
Here, an enemy() instruction adds an enemy to the scene. The prototype is the following :
Code: [Select]
enemy(x, y, imgID, bulletImgID, callbackID, polarity, hasRotation)
Due to the project using LUTs to speed up ... well, everything that can be speeded up, no images or pointers to functions are passed. Everything is handled by IDs that are looked up in the corresponding tables. So yeah, for now that makes level editing impossible to anyone but me, but at that point of development, who cares, really Next, there's the cmd_killed instruction. It's a level stream command, waiting for every active enemy to be killed or having exited the map before carrying on the level stream. I also implemented the cmd_wait(frames) instruction, whose purpose is obvious, but it's not used yet.
Then, the end of the level stream is marked by LVLSTR_END. When this point is reached, the game waits for every enemies to be killed, then quits - although for now you can't kill enemies so we'll see if that works when I'll implement collisions
Here's a screenshot of the above level stream :
This time, I'll really work on collision detection I just hope it won't slow things too much - although I'm certain that it will.