0 Favourites

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

This forum is currently in read-only mode.
  • 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!

    Flying cows: (Violence warning)http://youtu.be/rulL_S7KyG4?t=21m55s

    Arrows: youtube.com/watch

  • 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.

  • ...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...

    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!!

  • 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 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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): 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
1,941 263,273
FlyingRam's avatar
FlyingRam
Unread sticky
763 305,658
asikanddestroy's avatar
asikanddestroy
Unread hot topic
232 177,676
Tetriser's avatar
Tetriser