Faux-3D for 2D game?

Just started using Construct 2? Post your questions here

Post » Tue Mar 24, 2015 8:49 pm

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?
B
4
Posts: 12
Reputation: 224

Post » Tue Mar 24, 2015 10:18 pm

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.
B
7
S
3
G
1
Posts: 184
Reputation: 1,352

Post » Tue Mar 24, 2015 11:05 pm

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
B
7
S
3
G
1
Posts: 184
Reputation: 1,352

Post » Wed Mar 25, 2015 5:40 pm

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!
B
4
Posts: 12
Reputation: 224

Post » Thu Mar 26, 2015 2:31 pm

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?
B
4
Posts: 12
Reputation: 224


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests