trajectories can now be shared for several enemies (fleets) + new assets + adjustable background speed + ...
|
@ -69,6 +69,15 @@ set(ASSETS_cg
|
|||
|
||||
assets-cg/Sprites/Players/mainship1.png
|
||||
assets-cg/Sprites/Players/Satellite_Lvl1.png
|
||||
assets-cg/Sprites/Players/player_ship1.png
|
||||
assets-cg/Sprites/Players/player_ship2.png
|
||||
assets-cg/Sprites/Players/player_ship3.png
|
||||
assets-cg/Sprites/Players/player_ship4.png
|
||||
assets-cg/Sprites/Players/player_ship5.png
|
||||
assets-cg/Sprites/Players/player_ship6.png
|
||||
assets-cg/Sprites/Players/player_ship7.png
|
||||
assets-cg/Sprites/Players/player_ship8.png
|
||||
|
||||
|
||||
assets-cg/Sprites/Enemies/Lifebar.png
|
||||
assets-cg/Sprites/Enemies/mainship2.png
|
||||
|
@ -79,8 +88,9 @@ set(ASSETS_cg
|
|||
assets-cg/Sprites/Boss/BossGun.png
|
||||
|
||||
assets-cg/Levels/tileset.png
|
||||
assets-cg/Levels/Level1.json
|
||||
assets-cg/Levels/Level2.json
|
||||
# assets-cg/Levels/Tileset_Space.json
|
||||
# assets-cg/Levels/Tileset_Space.json
|
||||
# ...
|
||||
)
|
||||
|
||||
|
|
18
TODO.txt
|
@ -12,6 +12,7 @@
|
|||
- animer des éléments du décors (clignotements, sprites animés, ...)
|
||||
- interaction avec le décors (collisions possibles avec certaines tiles) qui imposent donc de suivre un "chemin" dans le niveau
|
||||
- [DONE] multiple layers de tiles pour avoir des niveaux plus beaux
|
||||
- implémenter des vitesses de défilement variables pour les décors de fond.
|
||||
|
||||
|
||||
## Partie mouvement :
|
||||
|
@ -29,6 +30,7 @@
|
|||
- [DONE] implémenter un système de bonus (points, upgrade tir/satellites/... )
|
||||
- implémenter un système d'amélioration de compétence de tirs (bullet -> mega bullet -> laser -> mega laser -> bomb -> etc.)
|
||||
- implémenter un système d'animation du vaisseau (réacteurs par exemple)
|
||||
- implémenter un système de boost des munitions si on garde le doigt appuyé sur la touche de laser
|
||||
|
||||
|
||||
## Scenario
|
||||
|
@ -58,6 +60,8 @@
|
|||
o boss 3 : "Gun Crab"
|
||||
o boss 4 : "Demoniac Snake"
|
||||
o boss 5 : "Space Octopus"
|
||||
o ...
|
||||
o boss of the boss "Zgrog Master"
|
||||
- création de séquences avec les boss (différentes phases)
|
||||
- créations de différentes armes
|
||||
- [DONE - CAN BE IMPROVED] créations de différents bonus
|
||||
|
@ -84,10 +88,14 @@
|
|||
## Histoire (à peaufiner)
|
||||
|
||||
En tant de Space Marshall, votre rôle est de faire respecter
|
||||
la loi intergalactique et de punir les contrevenants.
|
||||
Votre périmètre se situe dans le Grand Amas de RUZA-25f/s
|
||||
la loi intergalactique et de punir les contrevenants afin d'assurer
|
||||
la paix et le bon vivre ensemble des différentes civilisations aliens
|
||||
vivant dans votre zone de l'espace à surveiller.
|
||||
Votre périmètre englobe le Grand Amas de RUZA-25f/s dans ons entièreté
|
||||
et armé de votre vaisseau, vous devez aider les civilisations
|
||||
locales en pourchassant et anéantissant les hordes de Zgrog.
|
||||
Cette race alien robotique a pour but de coloniser les planètes
|
||||
et les stations orbitales géantes pour faire disparaître tout
|
||||
vie organique.
|
||||
Cette race alien robotique s'est donné pour but de coloniser les planètes
|
||||
et les stations orbitales géantes afin d'y faire disparaître toute
|
||||
vie organique.
|
||||
C'est donc un combat sans relâche que de traquer et de détruire cet
|
||||
envahisseur dénué d'âme.
|
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1017 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 3.4 KiB |
|
@ -8,13 +8,14 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
extern struct Map map_Level1;
|
||||
extern struct Map map_Level2;
|
||||
|
||||
Map *map_Level;
|
||||
|
||||
Background::Background( )
|
||||
{
|
||||
|
||||
map_Level = &map_Level1;
|
||||
speed = libnum::num(1.0);
|
||||
}
|
||||
|
||||
Background::~Background( )
|
||||
|
@ -29,18 +30,18 @@ void Background::Render( void )
|
|||
int y0 = (int) ylevel;
|
||||
int yshifttile = (int) (16*ylevel.frac());
|
||||
|
||||
for(int u=0; u<map_Level2.nblayers;u++)
|
||||
for(int u=0; u<map_Level->nblayers;u++)
|
||||
for(int i=0; i<=25; i++)
|
||||
{
|
||||
for(int j=0; j<=14; j++)
|
||||
{
|
||||
uint16_t index = (j+y0) * map_Level2.w + (x0+i) % map_Level2.w;
|
||||
uint16_t currentTile = map_Level2.layers[u][ index ];
|
||||
uint16_t index = (j+y0) * map_Level->w + (x0+i) % map_Level->w;
|
||||
uint16_t currentTile = map_Level->layers[u][ index ];
|
||||
if (currentTile!=0)
|
||||
{
|
||||
uint16_t xtile = ((currentTile % map_Level2.tileset_size)-1) * 16;
|
||||
uint16_t ytile = (currentTile / map_Level2.tileset_size) * 16;
|
||||
azrp_subimage_p8( i*16-xshifttile, j*16-yshifttile, map_Level2.tileset, xtile, ytile, 16, 16, DIMAGE_NONE );
|
||||
uint16_t xtile = ((currentTile % map_Level->tileset_size)-1) * 16;
|
||||
uint16_t ytile = (currentTile / map_Level->tileset_size) * 16;
|
||||
azrp_subimage_p8( i*16-xshifttile, j*16-yshifttile, map_Level->tileset, xtile, ytile, 16, 16, DIMAGE_NONE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,17 +52,17 @@ void Background::Render( void )
|
|||
|
||||
uint16_t tilemap[25*14]={0};
|
||||
|
||||
for(int u=0; u<map_Level2.nblayers;u++)
|
||||
for(int u=0; u<map_Level->nblayers;u++)
|
||||
{
|
||||
for(int j=0; j<14; j++)
|
||||
{
|
||||
for(int i=0; i<=25; i++)
|
||||
{
|
||||
uint16_t index = j * map_Level2.w + (x0+i) % map_Level2.w;
|
||||
tilemap[25*j+i]= cmap_Level2.layers[u][ index ];
|
||||
uint16_t index = j * map_Level->w + (x0+i) % map_Level->w;
|
||||
tilemap[25*j+i]= cmap_Level->layers[u][ index ];
|
||||
}
|
||||
}
|
||||
azrp_tilesmap( shifttile, tilemap, map_Level2.tileset, map_Level2.tileset_size);
|
||||
azrp_tilesmap( shifttile, tilemap, map_Level->tileset, map_Level->tileset_size);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -69,7 +70,13 @@ void Background::Render( void )
|
|||
void Background::Update( float dt )
|
||||
{
|
||||
libnum::num a = libnum::num( dt / 90000.0f); //18000.0f );
|
||||
xlevel += a;
|
||||
xlevel += speed*a;
|
||||
}
|
||||
|
||||
|
||||
void Background::SetSpeed(libnum::num s)
|
||||
{
|
||||
speed = s;
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,7 +89,7 @@ void Background::IncYCoordinate( libnum::num y )
|
|||
{
|
||||
ylevel += y ;
|
||||
if (ylevel<0) ylevel=libnum::num(0);
|
||||
if (ylevel>map_Level2.h-14) ylevel=libnum::num(map_Level2.h-14);
|
||||
if (ylevel>map_Level->h-14) ylevel=libnum::num(map_Level->h-14);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,8 +38,11 @@ class Background
|
|||
int GetXCoordinate( void );
|
||||
int GetYCoordinate( void );
|
||||
|
||||
void SetSpeed( libnum::num s );
|
||||
|
||||
private:
|
||||
libnum::num xlevel, ylevel;
|
||||
libnum::num speed;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ Bonus::Bonus( int16_t _x, int16_t _y, uint8_t _id )
|
|||
|
||||
currentframe = libnum::num(0);
|
||||
|
||||
accumulatedTime = 0.0f;
|
||||
}
|
||||
|
||||
Bonus::~Bonus()
|
||||
|
@ -61,7 +62,7 @@ void Bonus::Update( float dt )
|
|||
}
|
||||
else
|
||||
{
|
||||
pathToFollow->CalculatePosition( dt, speed, true, &x, &y );
|
||||
pathToFollow->CalculatePosition( &accumulatedTime, dt, speed, true, &x, &y );
|
||||
}
|
||||
|
||||
xmin = (int) x - width;
|
||||
|
|
|
@ -32,7 +32,9 @@ class Bonus
|
|||
|
||||
private:
|
||||
int8_t dirx, diry;
|
||||
libnum::num currentframe;
|
||||
libnum::num currentframe;
|
||||
|
||||
float accumulatedTime;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -154,6 +154,7 @@ Boss::Boss( int16_t _x, int16_t _y, uint8_t _id )
|
|||
Guns[i].toberemoved = false;
|
||||
}
|
||||
|
||||
accumulatedTime = 0.0f;
|
||||
/* FOR DEBUGGING */
|
||||
// gint_world_switch( GINT_CALL( savedata ) );
|
||||
|
||||
|
@ -171,7 +172,7 @@ void Boss::Update( float dt )
|
|||
|
||||
if (hasTrajectory)
|
||||
{
|
||||
pathToFollow->CalculatePosition( dt, speed, true, &x, &y );
|
||||
pathToFollow->CalculatePosition( &accumulatedTime, dt, speed, true, &x, &y );
|
||||
}
|
||||
|
||||
xmin = (int) x - width;
|
||||
|
|
|
@ -60,6 +60,8 @@ class Boss
|
|||
uint32_t lastshoot0 = 0;
|
||||
uint32_t lastshoot1 = 0;
|
||||
|
||||
float accumulatedTime;
|
||||
|
||||
bool Shoot_OK( uint32_t tempshoot, uint8_t shootID );
|
||||
};
|
||||
|
||||
|
|
|
@ -87,10 +87,26 @@ void Create_Enemies( void )
|
|||
MyTrajectory->AddPoint( F );
|
||||
MyTrajectory->AddPoint( G );
|
||||
|
||||
|
||||
Enemy* e5 = new Enemy( 348, 112, 2);
|
||||
e5->hasTrajectory = true;
|
||||
e5->pathToFollow = MyTrajectory;
|
||||
e5->Set_Accumulated_Time(0.0f);
|
||||
|
||||
Enemy* e6 = new Enemy( 348, 112, 2);
|
||||
e6->hasTrajectory = true;
|
||||
e6->pathToFollow = MyTrajectory;
|
||||
e6->Set_Accumulated_Time(-1.0f);
|
||||
|
||||
Enemy* e7 = new Enemy( 348, 112, 2);
|
||||
e7->hasTrajectory = true;
|
||||
e7->pathToFollow = MyTrajectory;
|
||||
e7->Set_Accumulated_Time(-2.0f);
|
||||
|
||||
|
||||
MyEnemies.push_back( e5 );
|
||||
MyEnemies.push_back( e6 );
|
||||
MyEnemies.push_back( e7 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@ Enemy::Enemy( int16_t _x, int16_t _y, uint8_t _id )
|
|||
toberemoved = false;
|
||||
|
||||
lastshottime = 0;
|
||||
|
||||
accumulatedTime = 0.0f;
|
||||
}
|
||||
|
||||
Enemy::~Enemy()
|
||||
|
@ -76,7 +78,7 @@ void Enemy::Update( float dt )
|
|||
}
|
||||
else
|
||||
{
|
||||
pathToFollow->CalculatePosition( dt, speed, true, &x, &y );
|
||||
pathToFollow->CalculatePosition( &accumulatedTime, dt, speed, true, &x, &y );
|
||||
}
|
||||
|
||||
xmin = (int) x - width;
|
||||
|
@ -87,7 +89,7 @@ void Enemy::Update( float dt )
|
|||
|
||||
uint32_t tempshoot = rtc_ticks();
|
||||
|
||||
if (Shoot_OK( tempshoot ))
|
||||
if (Shoot_OK( tempshoot, 0 ))
|
||||
{
|
||||
if ( ID==0 )
|
||||
{
|
||||
|
@ -153,14 +155,19 @@ bool Enemy::Test_Impact( Bullet *projectile )
|
|||
else return false;
|
||||
}
|
||||
|
||||
void Enemy::Set_Speed_Vector( uint8_t _sp, uint8_t _xd, uint8_t _yd)
|
||||
void Enemy::Set_Speed_Vector( uint8_t _sp, uint8_t _xd, uint8_t _yd )
|
||||
{
|
||||
speed = _sp;
|
||||
dirx = _xd;
|
||||
diry = _yd;
|
||||
}
|
||||
|
||||
bool Enemy::Shoot_OK( uint32_t tempshoot )
|
||||
void Enemy::Set_Accumulated_Time( float value )
|
||||
{
|
||||
accumulatedTime = value;
|
||||
}
|
||||
|
||||
bool Enemy::Shoot_OK( uint32_t tempshoot, uint8_t shootID )
|
||||
{
|
||||
if(tempshoot-lastshottime>15)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,8 @@ class Enemy
|
|||
bool Test_Impact( Bullet *projectile );
|
||||
void Set_Speed_Vector( uint8_t _sp, uint8_t _xd, uint8_t _yd);
|
||||
|
||||
void Set_Accumulated_Time( float value );
|
||||
|
||||
libnum::num x, y; // center position of the ennemy
|
||||
uint8_t width, height; // width and height -for the hitbox
|
||||
int16_t xmin, xmax, ymin, ymax; // square hitbox (to speed up the bullet impact calculations)
|
||||
|
@ -39,8 +41,9 @@ class Enemy
|
|||
int8_t dirx, diry; // vector of the current direction of the ennemy (TODO : to implement more complex displacement pattern)
|
||||
|
||||
uint32_t lastshottime;
|
||||
float accumulatedTime;
|
||||
|
||||
bool Shoot_OK( uint32_t tempshoot );
|
||||
bool Shoot_OK( uint32_t tempshoot, uint8_t shootID );
|
||||
};
|
||||
|
||||
|
||||
|
|
15
src/main.cpp
|
@ -350,6 +350,11 @@ static void get_inputs( float dt )
|
|||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F2)) {texttodraw=1;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F3)) {texttodraw=2;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F4)) {texttodraw=3;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F5))
|
||||
{
|
||||
drawback = !drawback;
|
||||
drawstars = ! drawstars;
|
||||
}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F6))
|
||||
{
|
||||
azrp_starfield_close( );
|
||||
|
@ -474,20 +479,18 @@ int main(void)
|
|||
__printf_enable_fixed();
|
||||
|
||||
azrp_config_scale(SCALE_PIXEL);
|
||||
//azrp_shader_clear_configure();
|
||||
//azrp_shader_image_rgb16_configure();
|
||||
//azrp_shader_image_p8_configure();
|
||||
//azrp_shader_image_p4_configure();
|
||||
|
||||
#if(USB)
|
||||
azrp_hook_set_prefrag(hook_prefrag);
|
||||
#endif
|
||||
|
||||
azrp_starfield_init( 250 );
|
||||
|
||||
//Create_Enemies( );
|
||||
Create_Enemies( );
|
||||
|
||||
MyPlayer = new Player( azrp_width/4, azrp_height/2, 0);
|
||||
|
||||
/*
|
||||
MyBoss = new Boss( 3*azrp_width/4, azrp_height/2, 0);
|
||||
|
||||
|
||||
|
@ -510,7 +513,7 @@ int main(void)
|
|||
|
||||
MyBoss->hasTrajectory = true;
|
||||
MyBoss->pathToFollow = MyTrajectory;
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
#if(DBGCRSH)
|
||||
|
|
|
@ -10,19 +10,31 @@
|
|||
|
||||
|
||||
extern bopti_image_t img_Lifebar;
|
||||
extern bopti_image_t img_mainship1;
|
||||
extern bopti_image_t *img_mainship1;
|
||||
|
||||
extern bopti_image_t img_player_ship1;
|
||||
extern bopti_image_t img_player_ship2;
|
||||
extern bopti_image_t img_player_ship3;
|
||||
extern bopti_image_t img_player_ship4;
|
||||
extern bopti_image_t img_player_ship5;
|
||||
extern bopti_image_t img_player_ship6;
|
||||
extern bopti_image_t img_player_ship7;
|
||||
extern bopti_image_t img_player_ship8;
|
||||
|
||||
extern bopti_image_t img_Satellite_Lvl1;
|
||||
extern Background MyBackground;
|
||||
|
||||
Player::Player( int16_t _x, int16_t _y, uint8_t _id )
|
||||
{
|
||||
img_mainship1 = &img_player_ship7;
|
||||
|
||||
x = libnum::num(_x);
|
||||
y = libnum::num(_y);
|
||||
|
||||
ID = _id;
|
||||
|
||||
width = img_mainship1.width/2;
|
||||
height = img_mainship1.height/2;
|
||||
width = img_mainship1->width/2;
|
||||
height = img_mainship1->height/2;
|
||||
speed = 10;
|
||||
|
||||
xmin = (int) x - width;
|
||||
|
@ -68,7 +80,7 @@ void Player::Render( void )
|
|||
{
|
||||
azrp_subimage_p8_effect( (int) x - img_Lifebar.width/2, ymin - 10, &img_Lifebar, 0, 0, img_Lifebar.width, 7, DIMAGE_NONE );
|
||||
|
||||
if (ID==0) azrp_image_p8_effect(xmin, ymin, &img_mainship1, DIMAGE_NONE);
|
||||
if (ID==0) azrp_image_p8_effect(xmin, ymin, img_mainship1, DIMAGE_NONE);
|
||||
|
||||
int w = img_Satellite_Lvl1.width/2;
|
||||
int h = img_Satellite_Lvl1.height/2;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Trajectory::Trajectory( )
|
||||
{
|
||||
accumulatedTime = 0.0f;
|
||||
//accumulatedTime = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,25 +23,26 @@ void Trajectory::AddPoint( Point2D *p )
|
|||
}
|
||||
|
||||
|
||||
void Trajectory::CalculatePosition( float time, uint16_t speed, bool looped, libnum::num *xreturn, libnum::num *yreturn )
|
||||
void Trajectory::CalculatePosition( float *accumulatedTime, float time, uint16_t speed, bool looped, libnum::num *xreturn, libnum::num *yreturn )
|
||||
{
|
||||
accumulatedTime += speed * time / 2000000.0f;
|
||||
if (accumulatedTime>ControlPoints.size()) accumulatedTime-=ControlPoints.size();
|
||||
*accumulatedTime += speed * time / 2000000.0f;
|
||||
if (*accumulatedTime>ControlPoints.size()) *accumulatedTime-=ControlPoints.size();
|
||||
if (*accumulatedTime<0) *accumulatedTime+=ControlPoints.size();
|
||||
|
||||
libnum::num t = libnum::num( accumulatedTime - (int) accumulatedTime );
|
||||
libnum::num t = libnum::num( *accumulatedTime - (int) *accumulatedTime );
|
||||
|
||||
int p0, p1, p2, p3;
|
||||
|
||||
if (!looped)
|
||||
{
|
||||
p1 = (int) accumulatedTime + 1;
|
||||
p1 = (int) *accumulatedTime + 1;
|
||||
p2 = p1 + 1;
|
||||
p3 = p2 + 1;
|
||||
p0 = p1 - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
p1 = (int) accumulatedTime;
|
||||
p1 = (int) *accumulatedTime;
|
||||
p2 = (p1 + 1) % ControlPoints.size();
|
||||
p3 = (p2 + 1) % ControlPoints.size();
|
||||
p0 = p1 >= 1 ? p1 - 1 : ControlPoints.size() - 1;
|
||||
|
|
|
@ -16,11 +16,11 @@ class Trajectory
|
|||
~Trajectory( );
|
||||
|
||||
void AddPoint( Point2D *p );
|
||||
void CalculatePosition( float time, uint16_t speed, bool looped, libnum::num *xreturn, libnum::num *yreturn );
|
||||
void CalculatePosition( float *accumulatedTime, float time, uint16_t speed, bool looped, libnum::num *xreturn, libnum::num *yreturn );
|
||||
|
||||
std::vector<Point2D*> ControlPoints;
|
||||
bool isLoop;
|
||||
float accumulatedTime;
|
||||
//float accumulatedTime;
|
||||
};
|
||||
|
||||
|
||||
|
|