Semi 3d perspective in a 2d plane [SOLVED]

Get help using Construct 2

Post » Wed Sep 30, 2015 3:02 pm

To be clear from the start, I´m not talking neither about drop shadow shaders, shadow caster behaviour or anything like that.

It´s a super stupid thing that I have tried several times in the past, but because I´m still not good at programming, I wasn´t able to achieve this in a simple way (I once ended up making every moving object look like different shadow sprites with the actual object/s attached to it with the right altitude, shameful...). In the end the result was the one I wanted, but it wasn´t reliable in any way.

So the purpose is simple:
·A family of objects
-When one of these is created a shadow sprite attaches to it.
-Any object is able to move freely on the 2D plane and this shadow sprite is the reference of where the ground is.
-Thanks to these shadows, objects in the family can simulate altitude by doing things like hopping or jumping.
-Objects in the family can ride each other (see reference)

Image

Sidenote: I´ve had many issues with assigning a different object to a family (when one outside of family object does X, all members of a family do X, which is wrong) even though I´ve read about families, any info would be extra awesome!.

Reference: (credit goes to rubna)
https://pbs.twimg.com/tweet_video/CKr1NB4WEAAL47t.mp4

Any help would be really useful! It might come in handy for anyone else looking for a similar effect.
Last edited by CloveltOc on Sat Oct 03, 2015 2:05 pm, edited 1 time in total.
B
9
S
3
Posts: 150
Reputation: 1,264

Post » Wed Sep 30, 2015 9:08 pm

I'm not sure if it's what you're looking for, but a pin behaviour seems to do the trick?
Here's a quick CAPX for reference.
B
40
S
21
G
18
Posts: 153
Reputation: 12,308

Post » Thu Oct 01, 2015 9:01 am

@purplemonkey Not at all, pin would fix the shadow's position. If you look at the gifs I provided you would notice why it is nothing like that. And as I said, I am not talking about shaders or behaviours, just a little system to manage a sprite's altitude. I think I once saw a similar concept made by @R0j0hound , but I couldn't find it anywhere in the forum :(
B
9
S
3
Posts: 150
Reputation: 1,264

Post » Thu Oct 01, 2015 11:00 am

CloveltOc wrote:@purplemonkey Not at all, pin would fix the shadow's position. If you look at the gifs I provided you would notice why it is nothing like that. And as I said, I am not talking about shaders or behaviours, just a little system to manage a sprite's altitude. I think I once saw a similar concept made by @R0j0hound , but I couldn't find it anywhere in the forum :(

I see. Well dang, I think I actually have a CAPX of something similar that I found on this forum a while ago. I'm going to see if I can find it!

Edit: Looking at the GIF you provided, you could fake it though. Just use animations and all will be well. When the rabbit jumps (using an animation) match that with an animation for the shadow and it'll all look pretty much like that GIF. I've updated the old CAPX for reference.
B
40
S
21
G
18
Posts: 153
Reputation: 12,308

Post » Thu Oct 01, 2015 2:21 pm

@purplemonkey I think you didn´t understand. Your suggestion wasn´t bad at all, but at the beginning of my original post I said that I´ve accomplished this effect many times, but it was unreliable and tedious , having to tweak every affected object individually. It took a really, really long time, it was unstable, it wasn´t automated, it was buggy and it required waaaaay more code than a simple system that can´t be too hard to make and could be applied to any project, ever.

This system can now actually be made because of families, and other new things that were added. I´ve tried doing it myself, but like I said in my original post, I´ve ran into many problems with families.

In the first post I´ve listed the things that were accomplished by the previous "systems", so if anyone knows how to implement them or at least give me any clue of where to build a base from I would greatly appreciate it.

Thanks purplemonkey, though :)
B
9
S
3
Posts: 150
Reputation: 1,264

Post » Thu Oct 01, 2015 2:49 pm

CloveltOc wrote:@purplemonkey I think you didn´t understand. Your suggestion wasn´t bad at all, but at the beginning of my original post I said that I´ve accomplished this effect many times, but it was unreliable and tedious , having to tweak every affected object individually. It took a really, really long time, it was unstable, it wasn´t automated, it was buggy and it required waaaaay more code than a simple system that can´t be too hard to make and could be applied to any project, ever.

This system can now actually be made because of families, and other new things that were added. I´ve tried doing it myself, but like I said in my original post, I´ve ran into many problems with families.

In the first post I´ve listed the things that were accomplished by the previous "systems", so if anyone knows how to implement them or at least give me any clue of where to build a base from I would greatly appreciate it.

Thanks purplemonkey, though :)

All right, yeah I guess I've been a bit tired lately so my reading comprehension seems to be falling behind. That being said, now I'm interested as well and await an expert to come and save the day and enlighten us both!
B
40
S
21
G
18
Posts: 153
Reputation: 12,308

Post » Fri Oct 02, 2015 2:01 pm

@purplemonkey I really hope so too :) I´ve been having this issue for a long time now...
B
9
S
3
Posts: 150
Reputation: 1,264

Post » Fri Oct 02, 2015 2:38 pm

I've been thinking about this in the past and I think I figured out a way, but it still seems a bit "hacky".

The way I'd do it we would have 3 objects. The shadow, the object the shadow should cast from (we'll call it the player), and an invisible object that would bind the two together.

Then what you'd actually be controlling would be this invisible object, not the player. This way you could pin the shadow and the player to this object, and when the player wanted to jump you'd unpin him, make the jump, then pin again when he's done.

About families, if you want to create the same shadow sprite to each object of the family, it's simple - at the start of the layout, create a "For each (ordered)" for the family. This will run through each object in the family that's currently in the layout, then you can use actions like "For each (ordered) familyname -> create "shadow" at familyname.x familyname.y -> Pin "shadow" to familyname.x familyname.y".

Be sure to order it by familyname.iid too.

Of course, there's probably a better way, but that's how I'd do it.
B
122
S
42
G
40
Posts: 846
Reputation: 27,994

Post » Fri Oct 02, 2015 3:28 pm

Thanks for replying, @andreyin ! It´s really not a bad idea but it is basically like one of my first attempts, as I said in the first post (You did not control the actual objects, but the shadow sprites). I know pin might look like the easiest rout, but my experience in previous attemps with these hacky strats weren´t reliable at all (sprites would end up misalligned, jumping would be rather buggy etc) so I was thinking about a more wrapped up, simple family system.

About the families, that´s exactly the info I was looking for! I´ve tried it out and it works like a charm, it really gave me a big sigh of relief, thanks :) (I was using normal "for each" before, which was seemingly causing the issue)

Really sorry for making this stupid thing look like a big deal, because it really isn´t. :/
B
9
S
3
Posts: 150
Reputation: 1,264

Post » Fri Oct 02, 2015 6:26 pm

Something like this?

Using the container object both sprites will only reference the one created with it..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: digitalsoapbox, RetrocadeMedia and 1 guest