Author Topic: Changing an Actor's scale without moving  (Read 15163 times)

0 Members and 1 Guest are viewing this topic.

Offline MusicallyInspired

Re: Changing an Actor's scale without moving
« Reply #15 on: April 02, 2016, 05:33:41 PM »
Ah, I was calling it incorrectly. I wasn't invoking ScaleTo in setScale.

And yeah, I did a search through help so it probably took me to Studio SCI syntax entries.

EDIT: Really screwing up. It shrinks horizontally and maxes the height scale to the size of the screen and shrinks smaller than the target size I entered. Then it suddenly blows up to larger than the screen size and freezes there. It also locks up the whole game. Something wrong with ScaleTo's code maybe? I'm just running this as a test which should scale it down 50% 1 step at a time with 1 wait count and then cue the next state:

Code: [Select]
(actorShrink setScale: ScaleTo 50 1 1 self)
« Last Edit: April 02, 2016, 05:43:46 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline troflip

Re: Changing an Actor's scale without moving
« Reply #16 on: April 02, 2016, 05:45:10 PM »
That code works just fine with me.

You're sure you're just calling this once? And it's being called from a cue-able object? (e.g. a method in a Script instance).

Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Changing an Actor's scale without moving
« Reply #17 on: April 02, 2016, 05:45:28 PM »
Never mind any of that nonsense. I had the Actor setting its scale to 100 in the init method of the room. Removing that makes it work properly. Strange behaviour, though. Will do more experimenting and let you know if I got it working the way I want without problems.

EDIT: Eureka! Now I just need to get the palette intensity to fade out with it after it reaches a certain threshhold. What's a good way to do this and sync it up with ScaleTo? How I had it before was once the scale reached level 100 (of 128) the intensity (0 - 100) would decrease with it until both reached 0 at the same time. Would I need to utilize the doit method for this?
« Last Edit: April 02, 2016, 05:51:13 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline troflip

Re: Changing an Actor's scale without moving
« Reply #18 on: April 02, 2016, 06:11:44 PM »
Never mind any of that nonsense. I had the Actor setting its scale to 100 in the init method of the room. Removing that makes it work properly. Strange behaviour, though. Will do more experimenting and let you know if I got it working the way I want without problems.

There's more than just scaleX and scaleY properties. There's also scaleSignal and maxScale, and I suspect if you manipulate some of these without also changing the others, then things get wonky. Hence why they made the setScale method and the ScaleTo scaler.

EDIT: Eureka! Now I just need to get the palette intensity to fade out with it after it reaches a certain threshhold. What's a good way to do this and sync it up with ScaleTo? How I had it before was once the scale reached level 100 (of 128) the intensity (0 - 100) would decrease with it until both reached 0 at the same time. Would I need to utilize the doit method for this?

I can think of a few ways:
- Make an instance of ScaleTo in your room file and override its doit method (being sure to call (super doit:)), and then do whatever you want in the doit to change the palette. Then use this instance in the setScale call instead of the ScaleTo class.
- Given that you know the scale step and the start/target scales, you should be able to figure out how many cycles the scaling operation will take. So have a Script whose doit changes the palette intensity over this many cycles.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Changing an Actor's scale without moving
« Reply #19 on: April 02, 2016, 06:36:50 PM »
This is what I ended up doing in doIt. I couldn't figure out what to match the palette manipulation with so I made it condition on actorShrink's scaleX property, which would be the same as scaleY. However, it was far too fast so I made it only decrease after every 5 decrements of the scaling value. This slowed it down enough and also matched properly with the scaling rate, since I change the rate to shrink faster the smaller it gets.

Code: [Select]
(if (and (== actorFading TRUE) (> actorIntensity 0))
(if (== (mod (actorShrink scaleX:) 5) 0)
(-- actorIntensity)
(Palette
palSET_INTENSITY
0
63
actorIntensity
)
)
)
« Last Edit: April 02, 2016, 06:42:19 PM by MusicallyInspired »
Brass Lantern Prop Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.019 seconds with 18 queries.