Added YAML size attribute to circle sprites (for correct bullet size).

This commit is contained in:
Felix Ableitner 2013-05-27 17:42:36 +02:00
parent 45cfc8662d
commit 11f3800332
7 changed files with 10 additions and 46 deletions

View file

@ -3,4 +3,5 @@ texture: bullet.png
damage: 10
radius: 5
size: [3, 10]
speed: 1000

View file

@ -1,3 +1,4 @@
name: Corpse
texture: corpse.png
radius: 25.0
radius: 25
size: [50, 50]

View file

@ -1,2 +0,0 @@
name: Cover
texture: cover.png

View file

@ -2,7 +2,8 @@ name: Enemy
texture: enemy.png
health: 100
speed: 100.0
radius: 25.0
speed: 100
radius: 25
size: [50, 50]
weapon: weapon.yaml
faction: 1

View file

@ -1,36 +0,0 @@
# This file lists all existing YAML keys and their corresponding default values, along with a description.
## Sprite keys ##
# name to be displayed, currently unused
name: ""
# filename of texture resource, relative to resources/textures/
# no default value, has to be a valid texture file name (e.g. player.png)
texture: ""
# the object's size in pixels, in x and y direction, these should be equal for a character
size: [50, 50]
# radius from character center to border, used for collisions, generally half size
radius: 25.0
## Character keys ##
# filename of the weapon wielded
weapon: weapon.yaml
# starting/maximum health points
health: 100
# walking speed
speed: 100.0
# default weapon equipped
weapon: weapon.yaml
## Weapon keys ##
# yaml file where the bullet is defined
bullet: bullet.yaml
# milliseconds to wait before firing the next bullet, zero for no limit
interval: 250
# is the weapon automatic or not?
automatic: false
## Bullet keys ##
# damage per bullet
damage: 10
# movement speed of bullets
speed: 500.0
radius: 10.0

View file

@ -2,7 +2,8 @@ name: Player
texture: player.png
health: 100
speed: 100.0
radius: 25.0
speed: 100
radius: 25
size: [50, 50]
weapon: weapon.yaml
faction: 0

View file

@ -13,9 +13,7 @@
Circle::Circle(const sf::Vector2f& position, Category category,
unsigned short mask, const Yaml& config,
const sf::Vector2f& direction) :
Sprite(position, category, mask,
sf::Vector2f(config.get(YAML_KEY::RADIUS, 0.0f),
config.get(YAML_KEY::RADIUS, 0.0f)) * 2.0f,
Sprite(position, category, mask, config.get(YAML_KEY::SIZE, sf::Vector2f()),
config.get(YAML_KEY::TEXTURE, std::string()), direction) {
}