-
Notifications
You must be signed in to change notification settings - Fork 0
/
explosion.c
41 lines (31 loc) · 1.1 KB
/
explosion.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "explosion.h"
#include <tari/animation.h>
#include <tari/stagehandler.h>
#include <tari/soundeffect.h>
#include "stage.h"
#include "pussymode.h"
static struct {
int mBoomSFX;
Animation mExplosionAnimation;
TextureData mExplosion[20];
} gData;
void loadExplosions()
{
gData.mExplosionAnimation = createEmptyAnimation();
gData.mExplosionAnimation.mFrameAmount = 17;
gData.mExplosionAnimation.mDuration = 3;
loadConsecutiveTextures(gData.mExplosion, "assets/effects/EXPLOSION.pkg", gData.mExplosionAnimation.mFrameAmount);
gData.mBoomSFX = loadSoundEffect("assets/sfx/boom.wav");
}
void addExplosion(Position p, double r) {
playSoundEffect(gData.mBoomSFX);
if (!isInPussyMode()) {
addStageHandlerScreenShake(50);
}
double fac = 2.5;
double cfac = fac / 2;
p = vecSub(p, makePosition(cfac*r, cfac*r, 0));
int anim = playAnimation(p, gData.mExplosion, gData.mExplosionAnimation, makeRectangleFromTexture(gData.mExplosion[0]), NULL, NULL);
setAnimationScreenPositionReference(anim, getStagePositionReference());
setAnimationSize(anim, makePosition(fac*r, fac*r, 1), makePosition(0, 0, 0));
}