This is bugging me.

Need help with using DizzyAGE then look here
xelanoimis
Team Yolkfolk
Team Yolkfolk
Posts: 1014
Joined: Sun Jan 21, 2007 6:34 pm
Contact:

Post by xelanoimis » Sat Oct 23, 2010 8:05 pm

Code: Select all

//find player position
	px = PlayerGet(P_ X) ;
	py = PlayerGet(P_Y);

	//set box corner coords
	boxx = px+8;
	boxy = py-14;

	boxa = MaterialRead(boxx,boxy,2,16);
        mask_air = (1 < < MAT_AIR);
        if( ( boxa & (~mask_air) ) != 0 )
            return found_other_materials_than_air

xelanoimis
Team Yolkfolk
Team Yolkfolk
Posts: 1014
Joined: Sun Jan 21, 2007 6:34 pm
Contact:

Post by xelanoimis » Sat Oct 23, 2010 8:12 pm

Oh, here's the mistery:

1. Player's position returned by PlayerGet(P_ X) is in world coordinates and coresponds to the center of the player (at mouth)
2. The read material functions need the coordinates in room space

Do like this

Code: Select all

px = PlayerGet(P_ X) - GameGet(G_ROOM X) *GameGet(G_ROOMW);
py = PlayerGet(P_Y) - GameGet(G_ROOMY)*GameGet(G_ROOMH);
boxx = px+8;
boxy = py-14;
boxa = MaterialRead(boxx,boxy,2,16);
println (boxa);
and move the player with the mouth inside other material

I tested this in the update handler and it showed a different value there

delta
Hard Boiled Egg
Posts: 3965
Joined: Fri Feb 09, 2007 7:08 pm
Location: North West
Contact:

Post by delta » Sat Oct 23, 2010 8:16 pm

xelanoimis wrote: 1. Player's position returned by PlayerGet(P_ X) is in world coordinates and coresponds to the center of the player (at mouth)
2. The read material functions need the coordinates in room space
oh bloody bloody hell :dizzy_mad:

EDIT:: That's fixed it! Thank you very much! :D
Image

Image

"Quotes from the internet may not be genuine" - Abraham Lincoln

Post Reply