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

Get help using Construct 2

### » Fri Oct 02, 2015 7:22 pm

@LittleStain It´s kind of the idea, but that example is tied to a grid and is forced to use custom movement behaviour. What I was looking for was something way simpler:

Concept:
-A family has a variable that determines which "altitude" the object supposedly has (it only affects it´s Y)
-When a family member is created, it spawns a shadow sprite

The actual part where i´m having issues with:
-The object´s Y plus its "altitude" determines the shadow sprite´s Y
-Objects of this family can move their X and Y freely at all times, they aren´t tied to their shadow, it´s altitude is added without stopping any motion.

That is it. I just bringed up the "jumping" in the first place to show how the concept would adapt graphically to other things, the idea is that this system works for any desired sprite in any situation, because in previous attempts I had to make really hacky stuff to accomplish a rather buggy look. Yes, maybe jumping would be cool to add but the main concept is that simple.

I´ll try working around it if it´s too much to ask
B
9
S
3
Posts: 153
Reputation: 1,272

### » Fri Oct 02, 2015 9:38 pm

This may help:
https://dl.dropboxusercontent.com/u/542 ... hadow.capx

This creates a shadow sprite for each object of the family.
The shadow keeps track of the uid of the object it's paired with and how high it is, which i call "z".

Then to move the objects I just move the shadow and put the objects's position to (shadow.x, shadow.y-shadow.z)

For the jump I added another variable to shadow called "vz" which is just the vertical speed. Then I use the following to make it accelerate down due to gravity (400) but stop when z is 0. The result is a nice parabolic motion.

every tick:
add 400*dt to vz
set z to max(0, self.z+self.vz*dt)

Then to make it jump just set vz to -300 or something.

You could change it up to move the shadow instead of the object. ( shadow.y=object.y+shadow.z )
Just be sure to change the object's y when the z changes.
B
97
S
36
G
131
Posts: 5,513
Reputation: 83,464

### » Sat Oct 03, 2015 2:04 pm

Oh, my, @R0J0hound, can´t thank you enough. Works like a charm! I will be using this in many many occasions, thanks a LOT!
B
9
S
3
Posts: 153
Reputation: 1,272

Previous

Return to How do I....?

### Who is online

Users browsing this forum: No registered users and 21 guests