0
\$\begingroup\$

To be specific I want to do bad sprite scaling like in Operation Thunderbolt. For some reason I'm getting it all wrong so far.

I started over from scratch and I've literally got a sprite that follows the mouse and scales larger as the Y position increases. I've got a horizon line at y128. I don't want the sprite to start scaling until it passes the horizon. I've been through countless examples of pseudo 3d but I want to start simple, one thing at a time so I can get the maths right in my head :S

Right now the code is:

set scale: Sprite.Y / Scalerate

Which keeps the scaling even as I move the mouse up and down but now I want to limit it to only growing after the horizon at 128. As if a person is walking down the road at you, or maybe an equation that let's you set a start and end point on the y axis.

I'm totally new at the sprite scaling stuff!

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Some pictures might help understand what you're after. \$\endgroup\$ – Thomas Sep 13 '16 at 5:54
  • \$\begingroup\$ s16-us2.ixquick.com/cgi-bin/… How do I display img? \$\endgroup\$ – PlasticCogLiquid Sep 13 '16 at 22:55
  • \$\begingroup\$ Basically, a 3D road effect with scaling objects. Just a straight road, no fancy stuff. I'll figure it out eventually but my time is limited so if anyone can help in any way I'd appreciate it. I guess it's scaling to perspective that I'm after. Been reading up on some trig stuff but I work a lot so it's hard to soak it all in. The dirtier the better anyhow. :D I prefer hacks over proper technique but either way it good. \$\endgroup\$ – PlasticCogLiquid Sep 13 '16 at 23:03
3
\$\begingroup\$

Wouldn't something like this do?

if y > 128 then:
    set scale: (Sprite.Y - 128) / Scalerate
\$\endgroup\$
3
  • \$\begingroup\$ LOL. Yes. Shame \$\endgroup\$ – PlasticCogLiquid Sep 13 '16 at 19:48
  • \$\begingroup\$ Ah, ok. The thing is, I want it to treat the actual scale of the sprite as if it is at Y(0) at the horizon line. Currently the Sprite.Y would == 128 at the horizon. Sorry I'm really stupid with this. \$\endgroup\$ – PlasticCogLiquid Sep 13 '16 at 22:53
  • \$\begingroup\$ @PlasticCogLiquid See updated answer. \$\endgroup\$ – Thomas Sep 14 '16 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.