Character scaling using script

Started by MurrayL, Wed 15/08/2012 19:13:33

Previous topic - Next topic

MurrayL

I have a room in which there are no walkable areas, but I need to scale a character sprite. In other rooms, I've been able to use the built-in walkable area scaling property to set scaling factors of, for instance, 500%. Unfortunately, it seems that the Character.Scaling property is limited to a maximum of 200.

I was hoping someone could let me know if there's any reason for this limit, and if there's a way around it?

Thanks in advance!

Khris

I guess the reason is that the sprite starts to look really ugly at zoom levels above 200%...?
It's curious though that the room editor allows numbers much higher than 200.

Anyway, the first thing that comes to mind is using a walkable area. Is there any reason why you aren't using one? If you don't want the character to be able to walk, there's other ways of achieving that.

MurrayL

I don't suppose we could have this limit removed in future versions of AGS? It seems entirely arbitrary!

Khris

Again, I don't think it's arbitrary. One does not simply zoom stuff up to 500%, one (re)draws stuff at that size / draws stuff at the max needed size and scales down.
Since you didn't answer my question: why aren't you using a walkable area?

MurrayL

#4
Sorry Khris - I didn't mean to ignore the question! :) I only meant the limit seems arbitrary because it clearly isn't applied when using walkable area scaling in the editor properties panel.

At the moment I'm preventing the player from moving manually in the scene by disabling the walkable areas (and re-enabling them when they're needed).

Code: AGS
RestoreWalkableArea(1);
cPilot.Walk(260, 305, eBlock);
RemoveWalkableArea(1);


Is there a different way of preventing Walk To commands from working? I can't just disable the eModeWalkTo mouse mode, since it's the only cursor mode my game uses (it runs Look/Interact when over an object and Walk To otherwise).

Khris

You can intercept clicks by adding an on_mouse_click function to the room script:

Code: ags
function on_mouse_click(MouseButton button) {
  if (no_manual_walk && button == eMouseLeft && mouse.Mode == eModeWalkto) ClaimEvent();
}

ClaimEvent() prevents the global on_mouse_click from being run afterwards.

SMF spam blocked by CleanTalk