SOLVED: How to get character.height?

Started by Rocco, Wed 20/06/2012 17:31:10

Previous topic - Next topic

Rocco

I need the sprite height from the current character.Frame.

edit:
ok found the solution from monkey in another codesnippet somewhere: :)
Code: AGS

ViewFrame *frame = Game.GetViewFrame(cGuard_1.View,cGuard_1.Loop, cGuard_1.Frame);
int sprite_height = (Game.SpriteHeight[frame.Graphic]);



monkey0506

Blast! That guy's always leaving code snippets laying around. :P

Just for anyone reading this, don't forget about the Character.BlockingHeight property if that's what you really need, but if you're just looking for the height of the character's current frame, you would just grab the ViewFrame first.

P.S. I'm pretty sure I would never have put parenthesis around just Game.SpriteHeight itself (although I do like to use them a lot, some may say excessively, to make operational precedence clear and invariable). User preference though as it will work out the same. ;)

Rocco

#2
no you didnt -> http://www.adventuregamestudio.co.uk/yabb/index.php?topic=37906.msg498141#msg498141
and i neither, it was just for quicktesting, so i didnt mess around with unnecessary parenthesis. :) :P
cause i made a function of it:

Code: AGS
function Get_Character_Height(this Character*)
{
  ViewFrame *frame = Game.GetViewFrame(this.View, this.Loop, this.Frame);
  return Game.SpriteHeight[frame.Graphic];
} 


Quote from: monkey_05_06 on Wed 20/06/2012 21:12:33
Blast! That guy's always leaving code snippets laying around. :P
This is the greatest thing about AGS, codesnippets are laying around everywhere. :-D

SMF spam blocked by CleanTalk