• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Pause Between Teleports, Should Player Destroy/Respawn?

A

Anomaly

Guest
I have everything working for a pretty dramatic type of bells and whistles n fireworks teleportation feature going on ..if i do say so myself...

so it's not (game-time) instantaneous.. .like you don't touch one pad and appear on the next instantly.. there's time and animation involved, not to mention the camera panning from the first teleport pad to the second with the camera pointing at it before the player arrives...etc..

i tried destroying my character then re-create him after the theatrics but too many other in game things mention that Player in their code (popular guy i know right?)

so i guess i could hop his image index to a blank one and freeze that then detour around the controller input while it the pause lasts?

are there simpler ways made especially for a temporary "VOID" of player's presence??
deactivate?

thanks!
 

NightFrost

Member
Wrap the player sprite draw inside a conditional that checks for teleport effect being active.
Code:
// Player draw event
if(is_teleporting == false){
    // draw code
}
 
A

Anomaly

Guest
but if it's drawn then the object's not in the room right.. because i just did what you suggested and the custom camera can't find the player to follow now.. :/
 

NightFrost

Member
Drawing or not drawing the sprite doesn't matter as it is simply a visual effect; the instance should still exist in the room. How does your custom camera lock onto the player, and is there some code in the draw event besides sprite command(s)?
 
A

Anomaly

Guest
In camera create, follow = player
In step, follow us mentioned, and crashes because player is deactivated...can't be found...

Driving me nuts
 
A

Anomaly

Guest
I had it working fine, but the 2nd teleporters animation had already happened by the time the camera panned to it.

So I Need the player to be invisible and unable to be controlled by its inputs until the pan is done, then the end teleporter animation is done.
 

Jakylgamer

Member
when referencing the player or any object from another object i recommend using with(object)
this way it only executes if the object is present at the time the code runs.

a little example would be
Code:
if place_meeting(x,y,obj_player) && keyboard_check_pressed(vk_down) {
   with(obj_player) { 
      x = other.x + 32;//other jumps back out of the with statement then grabs the calling objects x value then sets the players value to that + 32
      y = other.y; 
   }
}
and to keep the player from moving when teleporting i recommend a state system.
simple state system
Code:
switch(state) {
   case "idle":
      //enable controls / movements to here
   break;

   case "teleporting":
      //do nothing while teleporting
   break;
}
 
A

Anomaly

Guest
Yeah I'm on it.
Just had to bring all the scattered code from all over the place into one script, that fires if I'm currently teleporting.

If not, all inputs and movement scripts play.

Man I over complicate things.

Thx for the nudges guys
 
A

Anomaly

Guest
Figures

Fixed it all using states
 
Last edited by a moderator:
Top