Project and object into Z space

snortch

  • Posts: 25
I asked this question over on the GameSalad forum (http://gamesalad.com/forums/topic.php?id=3748) and I think the answer will likely be the same with Stencyl but wanted to ask anyway.

Is it possible to project an object into Zspace similar to the way this game called Slingshot Cowboy does it?:
http://www.youtube.com/watch?v=ae71NiaF7pc&feature=player_embedded

If not, how would you fake the effect to make it look like a projectile is moving away from you after being launched by some kind of slingshot launcher?

Thanks in advance for any brain power applied to this question.

decletro

  • Posts: 235
I guess you could scale down the size of the projectile over time and create some kind of projectile formula for the y value but there isn't any blocks in Stencyl that can do that automatically.

snortch

  • Posts: 25
When you say that there aren't any blocks in Stencyl that can accomplish the dynamic scaling of an object, are you saying that it isn't possible at all or that you would need to create the logic of dynamic scaling using your own blend of the available kinds of Stencyl blocks?

Hectate

  • *
  • Posts: 4643
Yes, anything moving away would get smaller. Two ways I might implement it...

1. If the objects move away from the viewpoint slowly but still needs to actually animate, have multiple animations where each one is smaller than the last. You could also use scaling on the sprite to smooth over the transition between sizes if necessary. Then, create a set of collision groups to assign to the animations that will be used to determine how "far" the projectile is from the player. The target (or obstacles) would have a matching set of animations (for how close or far it is) and thus would only sense "collisions" once both the projectile and the object were both in a matching set of collision groups (which means they're at the same "distance").

2. If the projectiles move quickly, you can do it with a single animation (where the projectile diminishes in size frame by frame). You'd create the collision sensor for the projectile at the smallest point of the animation so it's always precisely on target. Then, if it senses a "collision" with a target (or obstacle), it compare's the current frame number to the object's "range" value - another number that would correspond to a similar distance.


In either case, the Y motion is separate. Most likely you'd want to check the distance (as shown in 1 or 2 above) and set the Y velocity appropriately. While it's still near the player, make it negative to move it up. As it gets farther away, successively reduce it to zero and then make it positive to have it start coming down again.

Looking at the game shown in your video, it seems there's really only one actual distance to the targets and hitting/not hitting is merely determined by the X/Y position of the target. Everything else is just cosmetic - making it look "pretty".
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

snortch

  • Posts: 25
Cool! Thank you for this thorough description.

I wonder - Have you seen any example of Stencyl created games that might show this faked Z-space zoom effect?

Hectate

  • *
  • Posts: 4643
I don't remember any right now. There are plenty online (not made in Stencyl) I'm sure.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.