Make enemies always twitch forward a bit, even if they have animation frames.
This commit is contained in:
parent
389690e5c3
commit
806f8e4e1a
2 changed files with 10 additions and 10 deletions
|
@ -10,7 +10,7 @@
|
|||
{"_type": "Motion", "dx": 0, "dy": 0, "random": false},
|
||||
{"_type": "LightSource", "strength": 50, "radius": 1.0},
|
||||
{"_type": "EnemyConfig", "hearing_distance": 5},
|
||||
{"_type": "Animation", "scale": 0.2, "simple": true, "frames": 10, "speed": 1.0}
|
||||
{"_type": "Animation", "scale": 0.1, "simple": true, "frames": 10, "speed": 1.0}
|
||||
]
|
||||
},
|
||||
"KNIGHT": {
|
||||
|
@ -22,7 +22,7 @@
|
|||
{"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 1, "dead": false},
|
||||
{"_type": "Motion", "dx": 0, "dy": 0, "random": false},
|
||||
{"_type": "EnemyConfig", "hearing_distance": 5},
|
||||
{"_type": "Animation", "scale": 0.2, "simple": true, "frames": 10, "speed": 0.3},
|
||||
{"_type": "Animation", "scale": 0.1, "simple": true, "frames": 10, "speed": 0.3},
|
||||
{"_type": "Sprite", "name": "armored_knight"},
|
||||
{"_type": "Sound", "attack": "monster_1", "death": "monster_16"}
|
||||
]
|
||||
|
@ -37,7 +37,7 @@
|
|||
{"_type": "Motion", "dx": 0, "dy": 0, "random": true},
|
||||
{"_type": "EnemyConfig", "hearing_distance": 5},
|
||||
{"_type": "Sprite", "name": "axe_ranger"},
|
||||
{"_type": "Animation", "scale": 0.2, "simple": false, "frames": 10, "speed": 0.6},
|
||||
{"_type": "Animation", "scale": 0.1, "simple": false, "frames": 10, "speed": 0.6},
|
||||
{"_type": "Sound", "attack": "sword_1", "death": "monster_16"}
|
||||
]
|
||||
},
|
||||
|
@ -51,7 +51,7 @@
|
|||
{"_type": "Motion", "dx": 0, "dy": 0, "random": false},
|
||||
{"_type": "EnemyConfig", "hearing_distance": 5},
|
||||
{"_type": "Sprite", "name": "evil_eye"},
|
||||
{"_type": "Animation", "scale": 0.2, "simple": false, "frames": 10, "speed": 0.3},
|
||||
{"_type": "Animation", "scale": 0.1, "simple": false, "frames": 10, "speed": 0.3},
|
||||
{"_type": "Sound", "attack": "monster_1", "death": "monster_16"}
|
||||
]
|
||||
},
|
||||
|
@ -64,7 +64,7 @@
|
|||
{"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": false},
|
||||
{"_type": "Motion", "dx": 0, "dy": 0, "random": false},
|
||||
{"_type": "EnemyConfig", "hearing_distance": 10},
|
||||
{"_type": "Animation", "scale": 0.2, "simple": true, "frames": 10, "speed": 1.0},
|
||||
{"_type": "Animation", "scale": 0.1, "simple": true, "frames": 10, "speed": 1.0},
|
||||
{"_type": "Sprite", "name": "rat_with_sword"},
|
||||
{"_type": "Sound", "attack": "sword_1", "death": "monster_16"}
|
||||
]
|
||||
|
@ -78,7 +78,7 @@
|
|||
{"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": false},
|
||||
{"_type": "Motion", "dx": 0, "dy": 0, "random": false},
|
||||
{"_type": "EnemyConfig", "hearing_distance": 10},
|
||||
{"_type": "Animation", "scale": 0.2, "simple": true, "frames": 10, "speed": 1.0},
|
||||
{"_type": "Animation", "scale": 0.1, "simple": true, "frames": 10, "speed": 1.0},
|
||||
{"_type": "Sprite", "name": "hairy_spider"},
|
||||
{"_type": "Sound", "attack": "sword_1", "death": "monster_16"}
|
||||
]
|
||||
|
|
|
@ -48,10 +48,10 @@ namespace components {
|
|||
|
||||
void Animation::step(sf::Vector2f& scale_out, sf::IntRect& rect_out) {
|
||||
if(playing && current < frames) {
|
||||
if(simple) {
|
||||
scale_out.x += scale;
|
||||
scale_out.y += scale;
|
||||
} else {
|
||||
|
||||
if(!simple) {
|
||||
rect_out.position.x += current * TEXTURE_WIDTH;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue