Platform X Entity display

Piccolo

Well-known member
I was wondering if there was some kind of working way to correctly display/hide an entity based of his relative position to an obstacle.

platform1.png


platform2.png


I know I can create something similar to this via tricky scripts & "fake" entities usage, but it's quite painful  :'(
 
I just corrected the x offset (not platform offset) for plathalf from 140 to 149. I think it was a typo I did before I posted a full explanation for Piccolo.

nedflandeurse said:
OK,
Say me if I undertand right. The hard part is tweaking both sprite shapes, right?

BTW : it might be used as a tutorial.

To be honest, I don't understand what you mean by "tweaking both sprite shapes". Do you mean by having/gathering all the separated sprite shapes come together as one like you see in the example I indicated? If so, yeah, I used separate layers of shapes (before) but they overlap. It will be tough to have platforms overlap when you're on top of platforms. The best reference to use for avoiding top side overlap you is use the original platform sprite.

EDIT: What I learned recently about using 3D platforms is that what matters is creating 3D platforms (for coding) to match platform sprites accordingly. Also, to me, setting offset anywhere doesn't matter, just like any entity that can be set with position in which they can stand on.

Piccolo, you can use setlayer so characters don't show their hands or something for the right side of that platform. I noticed in the clown stage that setlayer is not used as you said or maybe it's not set right.
 
maxman said:
Piccolo, you can use setlayer so characters don't show their hands or something for the right side of that platform. I noticed in the clown stage that setlayer is not used as you said or maybe it's not set right.

Yeah I tried to do that, but can't get it to work without creating new visual problems (such as entity not displayed in front of the right side of the platform when it should be) . Plus, as these platforms are generated and spawned randomly, I would need to change setlayer procedurally.
 
Piccolo said:
maxman said:
Piccolo, you can use setlayer so characters don't show their hands or something for the right side of that platform. I noticed in the clown stage that setlayer is not used as you said or maybe it's not set right.

Yeah I tried to do that, but can't get it to work without creating new visual problems (such as entity not displayed in front of the right side of the platform when it should be) . Plus, as these platforms are generated and spawned randomly, I would need to change setlayer procedurally.

In fact!
There are problems:
1) It doesnt show the shadow when you are on platform
2) With 2 entities or up on the platform the entities are showed in wrong layers


SOLUTION:
I've found a good solution.
It use a lot of memory but is very good for me ^__^
stay tuned  ;) ;) ;)
 
Wow! That looks very clever, White Dragon! Are shadows scripted when it comes to the top of the platforms? I bet that would be very useful for Piccolo if he sees it for the clown stage (I guess).
 
maxman said:
Wow! That looks very clever, White Dragon! Are shadows scripted when it comes to the top of the platforms? I bet that would be very useful for Piccolo if he sees it for the clown stage (I guess).

Thanks guy!!
Yes I'm using scripted shadow!

Piccolo said:
Looks good, seems to have all the features  :) I wonder if you can concatenate blocks with this method though.

Thanks, yes you can concatenate more platforms! )
 
HOW TO:

write 3 entities:

BASE PLATFORM:
Code:
name  test_bigplatform
type none
shadow	0
facing	1
gfxshadow 0
setlayer 1 #195

#antigravity 100
subject_to_wall 0
subject_to_platform 0
subject_to_obstacle 0
subject_to_hole 0
subject_to_screen 0
subject_to_gravity 1
no_adjust_base 0

height 77

load test_bigplatform1
load test_bigplatform2

onspawnscript	@script
	#import "data/scripts/lib.c"

	void main() {
		void self = getlocalvar("self");
		void subent;

		setentityvar(self, 0, "walkable_platform");

		clearspawnentry();
		setspawnentry("name","test_bigplatform1");
		subent = spawn();
		bindentity(subent,self,0,0,0,1,0);

		clearspawnentry();
		setspawnentry("name","test_bigplatform2");
		subent = spawn();
		bindentity(subent,self,0,-70,0,1,0);


		/*bindentity(entity, target, int x, int z, int a, int direction, int bindanimation)
		~Bind entity to target, so the target moves, the entity moves.
		~x, z, a: relative to target.
		~direction: 0 no change 1 same direction as target -1 opposite direction as target 2 always right -2 always left
		~bindanimation: 0 No effect. 1 Keep same animation as the target. 2 Also keep same frame as the target. 4 Kill the entity if the animation doesn't match.
		~To unbind a entity, use bindentity(entity, NULL());
		~Notice: You can combine those values for bindanimation, so it can be 6 which means 2 and 4.*/
	}
@end_script

script	@script
	#import "data/scripts/lib_level.c"

	void main() {
		void self = getlocalvar("self");

		check_zpos_platform(self);
	}
@end_script


anim	idle
	loop	1
	delay	120
	offset	149 204
	platform	149 210 -93 -147 204 121 76 77
	frame	data/chars/misc/empty.gif

1° PLATFORM PART (gif at bottom):
Code:
name  test_bigplatform1
type none
shadow	0
gfxshadow 0
facing	1
setlayer 204

#antigravity 100
subject_to_wall 0
subject_to_platform 0
subject_to_obstacle 0
subject_to_screen 0
subject_to_gravity 0

anim	idle
	loop	1
	delay	120
	offset	149 204
	frame	data/bgs/debug/components/test_bigplatform1.gif
	#frame	data/chars/misc/empty.gif

2° PLATFORM PART (gif at bottom):
Code:
name  test_bigplatform2
type none
shadow	0
gfxshadow 0
facing	1

#antigravity 100
subject_to_wall 0
subject_to_platform 0
subject_to_obstacle 0
subject_to_screen 0
subject_to_gravity 0


anim	idle
	loop	1
	delay	120
	offset	149 134
	frame	data/bgs/debug/components/test_bigplatform2.gif

in the #level.txt write:
Code:
updatescript @script
#import "data/scripts/lib_level.c"

void main() {
	check_shadow(180,-5,0,256,50,220,0,0);
}
@end_script

spawn test_bigplatform 1
coords 200 240
at 0

copy in scripts directory, my libraries:
http://www.mediafire.com/download/dywmte7trwg7yba/libraries.zip

[attachment deleted by admin]
 
Hehe so shadows are scripted, cool. I'll try your solution tomorrow !

Edit : can you provide the images files you use for this example (test_bigplatform1.gif and test_bigplatform2.gif) ?
 
i think the problem is that you let characters to be too close to that plarform, you should create platform where character is always in front of it, so dont allow character to be that close when he is supposed to be behind platform to make it look "properly", it even looks bad if your character is hidden behind platform too much and is not visible.Just create platform in animation and make sure character cant be too closeto platform so he doesnt need to be behind platform.
 
Back
Top Bottom