Looking for Solution to Create 3d Projectiles in a 2d Game

For questions about using Classic.

Post » Sat Jan 24, 2015 12:04 am

Message: SpookySkeleton can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
Hello forum!

I have been racking my brain for a way to create the illusion of 3d projectiles within a 2d platform. The example that I found was an older game (completely 2d), that managed to create depth with arrows, flying cows, etc., Stronghold Crusader (great game). I'll post a some links to examples of this technique being used. Pseudocode welcome. If you need more examples or have any input, please let me know! Thanks for looking! :D

Flying cows: (Violence warning)http://youtu.be/rulL_S7KyG4?t=21m55s
Arrows: https://www.youtube.com/watch?v=gOVIHECq5ak
B
24
S
7
G
1
Posts: 36
Reputation: 2,049

Post » Sat Jan 24, 2015 12:23 am

Animation is probably the easiest method, as scaling can sometimes drain the performance. Otherwise, you could use an invisble object for the actual projectile, and then the graphic can grow and shrink based on SINE functions (essentially it should be like "width = object.value('startwidth') + sin(object.value('throwtime')) * object.value('startwidth')" but that's just a rough example.
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
119
S
41
G
17
Posts: 2,211
Reputation: 19,634

Post » Sat Jan 24, 2015 7:18 am

Jayjay wrote: ...You could use an invisble object for the actual projectile, and then the graphic can grow and shrink based on SINE functions (essentially it should be like "width = object.value('startwidth') + sin(object.value('throwtime')) * object.value('startwidth')" but that's just a rough example.


Thanks for the reply, Jayjay!!
I've been tossing that idea around, I wasn't sure if that would be the optimal way to implement. I hacked together a blotchy .cap where I regretfully don't think I got much closer... :oops:
I have the attack split into two parts: A shadow sprite, which basically is a bullet that heads straight towards a target, and a block sprite that flies overhead. Like in the video examples I posted earlier. The problem I'm having is telling the block sprite when to move on the Y axis to create a depth effect. Basically getting the two sprites to separate and come together smoothly with different distances to the target. This feels like it should be so simple but I'm having a hard time cracking this one :?
Here's a .cap showing where my progress is so far.
Any more advice is strongly appreciated!!
You do not have the required permissions to view the files attached to this post.
B
24
S
7
G
1
Posts: 36
Reputation: 2,049

Post » Sat Jan 24, 2015 11:11 pm

Hmm, I would say the trick is to set a destination for the bullet to hit no matter what before it's shot, then you know the start and end point of the projectile and can do the scale based on that (or, if you want it to always hit an object/around an object, just set the end point to somewhere near the target)

That way you can set the size as a % of distance from the center between both points (so it could be 50% size at start and end, and 200% at the middle).

Edit: Looks like you've got that idea started in your file already.

Double edit: Found this on my PC from an old forum example someone made and it looks like it might actually be close to what you wanted so I tweaked it a bit (original was called: Top Down Artillery.cap): https://dl.dropboxusercontent.com/u/471 ... ectile.cap

With some tweaking you could make the shadow change size too, but hopefully it's straight-forward!
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
119
S
41
G
17
Posts: 2,211
Reputation: 19,634

Post » Sun Jan 25, 2015 6:34 am

Message: SpookySkeleton can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Jayjay wrote:Hmm, I would say the trick is to set a destination for the bullet to hit no matter what before it's shot, then you know the start and end point of the projectile and can do the scale based on that (or, if you want it to always hit an object/around an object, just set the end point to somewhere near the target)

That way you can set the size as a % of distance from the center between both points (so it could be 50% size at start and end, and 200% at the middle).

Edit: Looks like you've got that idea started in your file already.

Double edit: Found this on my PC from an old forum example someone made and it looks like it might actually be close to what you wanted so I tweaked it a bit (original was called: Top Down Artillery.cap): https://dl.dropboxusercontent.com/u/471 ... ectile.cap

With some tweaking you could make the shadow change size too, but hopefully it's straight-forward!


This is beautiful, Jayjay! You don't disappoint! Now that that's fixed, I can't procrastinate on my project anymore hahaha Take care!
B
24
S
7
G
1
Posts: 36
Reputation: 2,049


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests