Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F626907
EnemyBoltEntity.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
EnemyBoltEntity.cpp
View Options
#include
"EnemyBoltEntity.h"
#include
"Constants.h"
#include
"sfml_game/ImageManager.h"
#include
"WitchBlastGame.h"
EnemyBoltEntity
::
EnemyBoltEntity
(
float
x
,
float
y
,
enumShotType
boltType
,
int
level
,
enemyTypeEnum
enemyType
)
:
BoltEntity
(
x
,
y
,
-1
,
boltType
,
level
)
{
damages
=
INITIAL_BOLT_DAMAGES
;
type
=
ENTITY_ENEMY_BOLT
;
this
->
enemyType
=
enemyType
;
viscosity
=
1.0f
;
switch
(
boltType
)
{
case
ShotTypeIce
:
frame
=
2
;
break
;
case
ShotTypeLightning
:
frame
=
5
;
break
;
case
ShotTypeFire
:
frame
=
6
;
break
;
case
ShotTypeBomb
:
frame
=
8
;
break
;
case
ShotTypeIllusion
:
frame
=
3
;
break
;
default
:
frame
=
1
;
break
;
}
setMap
(
game
().
getCurrentMap
(),
TILE_WIDTH
,
TILE_HEIGHT
,
0
,
0
);
}
void
EnemyBoltEntity
::
animate
(
float
delay
)
{
if
(
boltType
!=
ShotTypeBomb
)
particleGenerator
.
GenerateParticles
(
frame
,
IMAGE_BOLT
,
x
,
y
,
BOLT_WIDTH
,
BOLT_HEIGHT
,
boltType
==
ShotTypeLightning
?
Vector2D
(
20.0f
)
:
Vector2D
(
0.0f
,
0.0f
),
10
,
renderScale
);
z
=
y
+
height
;
CollidingSpriteEntity
::
animate
(
delay
);
if
(
boltType
!=
ShotTypeBomb
&&
(
lifetime
-
age
)
<
0.2f
)
{
if
(
age
>=
lifetime
)
sprite
.
setColor
(
sf
::
Color
(
255
,
255
,
255
,
0
));
else
sprite
.
setColor
(
sf
::
Color
(
255
,
255
,
255
,
(
sf
::
Uint8
)((
lifetime
-
age
)
/
0.2f
*
255
)));
}
if
(
boltType
==
ShotTypeIllusion
)
{
float
limit
=
16
;
if
(
x
<
limit
||
x
>
TILE_WIDTH
*
MAP_WIDTH
-
limit
||
y
<
limit
||
y
>
TILE_HEIGHT
*
MAP_HEIGHT
-
limit
)
{
isDying
=
true
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Nov 15, 1:20 AM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
122785
Default Alt Text
EnemyBoltEntity.cpp (1 KB)
Attached To
Mode
R78 witchblast
Attached
Detach File
Event Timeline