2 registered members (7th_zorro, dr_panther),
724
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Problem with Mario Kart-like respawn code
#442885
07/05/14 11:11
07/05/14 11:11
|
Joined: Jun 2014
Posts: 97 Lagos, Nigeria
tolu619
OP
Junior Member
|
OP
Junior Member
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
|
My game has a lot of 3D platforming sections. When the player falls off the path into an abyss, I want him to respawn at the nearest checkpoint (checkpoints aren't visible). I don't want to check whether player.z has dropped below a certain height because I'll need to use the respawn function in some other instances. For example, when a flying character starts to fly off into the distance away from the path, he should also respawn at the nearest check point. So I decided to use invisible walls that trigger the respawn function on collision. I'm certain I'm not doing the collision event right because my invisible walls are showing absolutely no sign of collision at all.
//THIS IS ATTACHED TO INVISIBLE WALLS/FLOORS
action RespawnFallenMonSurface()
{
my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_PUSH);
my.event = RespawnFallenMon;
}
//YOU CAN SEE I'VE ENDED UP COMMENTING OUT MOST OF THE FUNCTION. JUST TRYING TO GET IT TO SHOW ANY SIGN THAT IT DETECTED A COLLISION
function RespawnFallenMon()
{
if(event_type == EVENT_ENTITY)
{
beep();
printf("Touchdown!");
}
// beep();
// printf("Touchdown!");
// if(your.skill45 != 5555) //not a monster
// {beep(); wait(-1); return;}
// var test = 0;
// wait(1); //avoid engine errors
// if(test == 0)
// printf("Touchdown!");
// test = 1;
// vec_set(vector(your.x,your.y,your.z), LastSolidGround);
}
Do I need to add the following line to my player action? It seems to make absolutely no difference at all.
my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_PUSH);
Also, if the invisible floor is already in contact with level structures such as terrain or pillars, will it affect its detection of collision with the player?
|
|
|
Re: Problem with Mario Kart-like respawn code
[Re: tolu619]
#442894
07/05/14 13:43
07/05/14 13:43
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
When you want to use models instead of regions you have more objects for the renderer/ tree and especially for c_move to process. Other objects (such as effects/ exploding and falling chunks, enemies, birds, ...) will all need to ignore those models too resulting in more work for you. Then, on collision your player will stop mid-air immediately, depending on what you want to achieve this may look bad. In my sidescroller there are bottomless pits and when the player falls from the platform he should not stop for one frame or more mid-aid but just continue falling to his doom while playing the death animation. You could try and use IGNORE_PUSH and a low push value for your obstacle objects, too.
When using regions you can just move and scale them to any size that you want. Checking for all regions can be somehow circumvented when you just use region_find instead and then compare the result. You can call the regions for example "abyssXYZ" and compare for "abyss", then, if necessary, use the number XYZ to determine a spawning position easily.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|