Faux-3D for 2D game?

0 favourites
  • 5 posts
From the Asset Store
2d mushroom sprite 2d game character enmy sprite game art
  • I was trying to make my 2D game have kind of like a faux 3D aspect, you basically throw snowballs at targets. The game is just basically a flat background and targets will come up and you have to hit them. So I'm trying to make the snowballs being thrown to have an arc and to recede in space as they go farther away. I made the game in Flash, but I'm trying to use Construct 2 to recreate it and possibly make it better. The game is at my website, but my url got removed if you search for my username "Whiffer Sniffers" you will most likely find the site, it's for some reference to what I'm talking about.

    I've gotten the snowballs to shoot out of a kind-of "turret" and it shoots wherever the player aims to, but the snowballs just fly straight off the screen. I've tried adding gravity, which just makes the snowballs fall right back down, and I've tried to add some force/inpulse but then the snowballs just spin around like crazy they are orbiting something and fly off the screen. So is there a way to make the snowballs act like they do in the other game, where they look like thy actually go into the screen rather than just off the screen?

  • Hi Whiffer

    http://www.whiffersniffers.com/home/gam ... all-fight/

    So I think what you want to do is to have a size scaling effect for when they go further into the depth of the screen.

    I don't think this is a physics effect (it might be) but as you can only have one snowball at a time, i'd see it more as a custom effect for each snowball.. you could do something every tick. based on time and given start velocity and angle, you can then do a simple calculation of where everything is in x/y/z.

    once you have worked out the distance into the screen the snowball has gone... you could say something like size = size * (1-100/distance). when distance = 100, size = 0. then the image will keep shrinking as you move it along the screen.

    I suspect it would take no more than 2-3 events to do it.

  • feck it... what's 40 minutes of my life... most of which was getting a snowball.

    here's a capx with the functionality you want.

    https://www.dropbox.com/s/cnd9hqgc6zvxo ... .capx?dl=0

    it's not pretty and a bunch of hacks to get the gravity effect in.. but proof.. is possible.

    total of 4 events but that includes 2 events for the aiming cursor

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks so much! This will really help me out, I'm playing around with the settings in my game to get it right, but looks good!

  • I've been trying to mess with the code to make the snowball sort of like, if it was an animation, render more frames of the animation of the arc, but the stuff I've messed with in the code just makes the snowball faster or larger, is there a way to use the code to make it more smooth or would I need to try a different way to make it work to make it smoother?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)