Pretty descriptive title, huh? ;D
Not much more to be said about it, I guess... GUI controls already have these properties, but I'd like to have them for characters and especially objects, too.
ViewFrame* frame = Game.GetViewFrame(player.View, player.Loop, player.Frame);
int playerWidth = Game.SpriteWidth[frame.Graphic], playerHeight = Game.SpriteHeight[frame.Graphic];
int obj0Graphic;
if (object[0].View) {
frame = Game.GetViewFrame(object[0].View, object[0].Loop, object[0].Frame);
obj0Graphic = frame.Graphic;
}
else obj0Graphic = object[0].Graphic;
int obj0Width = Game.SpriteWidth[obj0Graphic], obj0Height = Game.SpriteHeight[obj0Graphic];
It's a bit more complicated than just a Character.Width/Height or Object.Width/Height property...but it is possible to get this information.
Presumably in the case of these properties you're asking for these properties would be read-only?
Or is what you really want the Character/Object.BlockingHeight/BlockingWidth properties?
[EDIT:]
int GetCharacterHeight(Character* Char) {
if (Char == null) return 0;
ViewFrame* frame = Game.GetViewFrame(Char.View, Char.Loop, Char.Frame);
return Game.SpriteHeight[frame.Graphic];
}
int GetCharacterWidth(Character* Char) {
if (Char == null) return 0;
ViewFrame* frame = Game.GetViewFrame(Char.View, Char.Loop, Char.Frame);
return Game.SpriteWidth[frame.Graphic];
}
int GetObjectHeight(Object* obj) {
if (obj == null) return 0;
if (obj.View) {
ViewFrame* frame = Game.GetViewFrame(obj.View, obj.Loop, obj.Frame);
return Game.SpriteHeight[frame.Graphic];
}
return Game.SpriteHeight[obj.Graphic];
}
int GetObjectWidth(Object* obj) {
if (obj == null) return 0;
if (obj.View) {
ViewFrame* frame = Game.GetViewFrame(obj.View, obj.Loop, obj.Frame);
return Game.SpriteWidth[frame.Graphic];
}
return Game.SpriteWidth[obj.Graphic];
}