tuned explosions details
This commit is contained in:
parent
2c4ae5619c
commit
61ef31bc16
|
@ -20,6 +20,7 @@ set(SOURCES
|
|||
)
|
||||
set(ASSETS_cg
|
||||
assets-cg/font.png
|
||||
assets-cg/Sprites/firstboom.png
|
||||
assets-cg/Sprites/emp_circ.png
|
||||
assets-cg/Sprites/fill_circ.png
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 231 B |
10
src/main.cpp
10
src/main.cpp
|
@ -85,7 +85,7 @@ static void hook_prefrag(int id, void *fragment, int size)
|
|||
|
||||
if(id == azrp_frag_count - 1) {
|
||||
usb_commit_sync(pipe);
|
||||
screenshot = false;
|
||||
//screenshot = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,12 +100,12 @@ void Create_Explosion( void )
|
|||
|
||||
srand(rtc_ticks());
|
||||
|
||||
uint16_t xexplosion = rand() % X_RESOL;
|
||||
uint16_t yexplosion = rand() % Y_RESOL;
|
||||
uint16_t xexplosion = 198;//rand() % X_RESOL;
|
||||
uint16_t yexplosion = 112;//rand() % Y_RESOL;
|
||||
|
||||
for(int i=0; i<50; i++)
|
||||
for(int i=0; i<=50; i++)
|
||||
{
|
||||
Particle *p = new Particle( xexplosion, yexplosion );
|
||||
Particle *p = new Particle( xexplosion, yexplosion, i );
|
||||
MyParticles.push_back( p );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,18 +10,25 @@
|
|||
|
||||
|
||||
extern bopti_image_t img_fill_circ;
|
||||
extern bopti_image_t img_firstboom;
|
||||
|
||||
|
||||
Particle::Particle( uint16_t lx, uint16_t ly )
|
||||
Particle::Particle( uint16_t lx, uint16_t ly, uint8_t id )
|
||||
{
|
||||
x = libnum::num( lx );
|
||||
y = libnum::num( ly );
|
||||
|
||||
sx = (libnum::num( rand() % 11 - 5 )) / 4 ;
|
||||
sy = (libnum::num( rand() % 11 - 5 )) / 4;
|
||||
sx = (libnum::num( rand() % 21 - 10 )) / 8;
|
||||
sy = (libnum::num( rand() % 21 - 10 )) / 8;
|
||||
|
||||
age = libnum::num( rand() % 3 );
|
||||
maxage = libnum::num( 30 + ( rand() % 20 ) );
|
||||
ID=id;
|
||||
|
||||
age = 0;
|
||||
|
||||
if (ID==0) incage = libnum::num(1);
|
||||
else incage = libnum::num( 1+ rand() % 2);
|
||||
|
||||
maxage = libnum::num( 30 + ( rand() % 25 ) );
|
||||
|
||||
size = libnum::num( 3 + ( rand() % 5 ) );
|
||||
|
||||
|
@ -39,7 +46,8 @@ void Particle::Update( float dt )
|
|||
libnum::num a = libnum::num( dt / 12000.0f );
|
||||
x += sx * a;
|
||||
y += sy * a;
|
||||
age += libnum::num( dt / 12000.0f );
|
||||
//age += libnum::num( dt / 12000.0f );
|
||||
age += libnum::num( dt / 12000.0f ) * incage;
|
||||
sx *= libnum::num( 0.90 );
|
||||
sy *= libnum::num( 0.90 );
|
||||
|
||||
|
@ -55,18 +63,24 @@ void Particle::Render( )
|
|||
uint16_t px = (int) x;
|
||||
uint16_t py = (int) y;
|
||||
|
||||
int color;
|
||||
if (ID==0 && age<5)
|
||||
{
|
||||
azrp_image_p8( px-12, py-12, &img_firstboom, DIMAGE_NONE );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( age > 38 ) color = 0x526A; // Dark Purple Gray-ish
|
||||
else if ( age > 30 ) color = 0x71D6; // Red Brown -ish
|
||||
else if ( age > 25 ) color = 0xF80D; // Dark Red
|
||||
else if ( age > 20 ) color = 0xFB80; // Red
|
||||
else if ( age > 15 ) color = 0xFFE0; // Yellow
|
||||
else color = 0xFFFF; // White
|
||||
|
||||
azrp_subimage_p8_dye( px-7, py-7,
|
||||
&img_fill_circ,
|
||||
dximg+7-sz, 7-sz, sz*2, sz*2,
|
||||
IMAGE_DYE, color );
|
||||
if (age>=10)
|
||||
{
|
||||
int color;
|
||||
|
||||
if ( age > 40 ) color = 0x526A; // Dark Purple Gray-ish
|
||||
else if ( age > 35 ) color = 0x71D6; // Red Brown -ish
|
||||
else if ( age > 30 ) color = 0xF80D; // Dark Red
|
||||
else if ( age > 25 ) color = 0xFB80; // Red
|
||||
else if ( age > 30 ) color = 0xFFE0; // Yellow
|
||||
else color = 0xFFFF; // White
|
||||
|
||||
azrp_subimage_p8_dye( px-sz, py-sz, &img_fill_circ, dximg+7-sz, 7-sz, sz*2, sz*2, IMAGE_DYE, color );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,14 +7,16 @@
|
|||
class Particle
|
||||
{
|
||||
public:
|
||||
Particle( uint16_t lx, uint16_t ly );
|
||||
Particle( uint16_t lx, uint16_t ly, uint8_t id );
|
||||
~Particle();
|
||||
void Update( float dt );
|
||||
void Render();
|
||||
|
||||
uint8_t ID;
|
||||
|
||||
libnum::num x, y;
|
||||
libnum::num sx, sy;
|
||||
libnum::num age, maxage;
|
||||
libnum::num age, maxage, incage;
|
||||
libnum::num size;
|
||||
bool toberemoved;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue