platform shadows

For questions about using Classic.

Post » Fri Sep 07, 2012 11:31 pm

I'm trying to come up with a good solution for a shadow effect I want in a platform game and I need help brainstorming the best way to accomplish it. I want the shadow to follow the player's x position but to always appear on the platform directly underneath the player (even if the platform if off the screen in the case of long falls).

This image sort of demonstrates what I'm looking for:



My first reaction is to use loops and a sprite that can start at the player and move down looking for collisions. I feel that might be somewhat CPU intensive just for a shadow effect. That's why I'm looking for other opinions.
B
20
S
5
G
3
Posts: 65
Reputation: 3,764

Post » Sat Sep 08, 2012 5:16 am

I used such a technique for an object to always face towards a correct angle for slopes and such. If you optimize it depending on the size of the platform objects (wider stepping etc.), it doesn't affect the cpu very much.

Another way could be to always detect the platform object at player.x and set shadow.y to platform.top (very rudimentary, just to tell the basic approach)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests