Slope Platforms

maxman

Well-known member
I'm wondering how I can make a platform a slope. What I want is a sloped platform to walk on. I checked on the basemap topic and I have to use level.c for doing it. Can't I make another level.c if I make another basemap script(s) based on utunnels's way? How can I make a platformer a slope? Do I need basemap or something?

The picture below shows a sloped platform and the other platform which the side is curved like a triangle for sides if I try to jump to it when it blocks.

[attachment deleted by admin]
 
Here my method:
Peel off a complex geometric shape in the most simple geometric shapes (see attachment).
The squares are walls/platforms and triangles are scripted platforms (see my stair script, in my case stair_l, stair_r) or a new basemap.
It would be even possible to script round geometric shapes (but it would require an huge waste of resources) with use of the pixel scanning feature: getgfxproperty(loadsprite (path), "pixels", i1, i2);

I re-post my basemap wrapper. Basemap is a bit bugged so you need to use check_t_walkoff (a threshold for ground detection). Use check_t_walkoff() in updatescript event and basemap in levescript in your level#.txt

Code:
void change_basemap(int map_index, float rx, float rz, float x_size, float z_size, float min_a, float max_a, int dir, int x_cont) {
    float x,z;
	float delta,a;

	changelevelproperty("basemap", map_index, "x", rx);
	changelevelproperty("basemap", map_index, "xsize", x_size+2);
	changelevelproperty("basemap", map_index, "z", rz);
	changelevelproperty("basemap", map_index, "zsize", z_size+2);
	delta = (max_a-min_a)/x_size;

	for( x = 0; x <= x_size; x++) {
		if ( dir == NULL() || dir > 0 ) a = x*delta + min_a;
		else a = max_a - (x*delta + min_a);

		if ( x_cont != NULL() ) {
            if ( dir == NULL() || dir > 0 ) {
                if ( x+rx > x_cont ) a = max_a; // connect with the wall more smoothly
            } else {
                if ( x < x_cont ) a = max_a;
            }
		}

		for ( z = 0; z <= z_size; z++) {
			changelevelproperty("basemap", map_index, "map", x, z, a);
		}
	}
}

void check_t_walkoff(void ent, float t_walkoff) {
        if ( getentityproperty(ent, "exists") ) {
            int type = getentityproperty(ent,"type");

			if ( type == openborconstant("TYPE_ENEMY") || type == openborconstant("TYPE_PLAYER") || type == openborconstant("TYPE_NPC")
                || type == openborconstant("TYPE_NONE") || type == openborconstant("TYPE_OBSTACLE") || type == openborconstant("TYPE_TRAP") ) {
                if ( !is_in_pain(ent) && !getentityproperty(ent,"noaicontrol") ) {
                    float y = getentityproperty(ent,"y");
                    float base = getentityproperty(ent,"base");

                    if ( y > base && y-base <= t_walkoff ) changeentityproperty(ent,"position",NULL(),NULL(),base);
                }
            }
        }

    return;
}

But a better way is my script!!

[attachment deleted by admin]
 
Back
Top Bottom