Jump to content


Photo

Jump to certain position after restarting room?


  • Please log in to reply
4 replies to this topic

#1 adhgarra

adhgarra

    GMC Member

  • GMC Member
  • 90 posts
  • Version:GM:Studio

Posted 28 September 2011 - 03:52 AM

Ok so I'm making a crash bandicoot fan game and I was wondering could you make an object appear at a certain place wen the room restart without using the persistent option.. Cause I want everything other object to jump to start except the main character.
  • 0

#2 kremling

kremling

    GMC Member

  • GMC Member
  • 164 posts

Posted 28 September 2011 - 03:55 AM

Do you mean like if the main player dies, he will restart to like a check point, and you want all the object objects in the room back to their original spot?
  • 0

#3 adhgarra

adhgarra

    GMC Member

  • GMC Member
  • 90 posts
  • Version:GM:Studio

Posted 28 September 2011 - 04:07 AM

Exactly!
  • 0

#4 Hazard94

Hazard94

    GMC Member

  • GMC Member
  • 56 posts
  • Version:GM8

Posted 28 September 2011 - 04:46 AM

if the objects you want to restart are not destroyed during the game try instead of game_restart() when the player dies:
with(all)
{
   if object_index!=obj_mainplayer // or whatever the main player's object index is (the ! means not)
   { x=xstart; y=ystart}
}

But if the instances are destroyed, this would be a little harder I think

Edited by Hazard94, 28 September 2011 - 04:46 AM.

  • 0

#5 Yal

Yal

    Gun Princess

  • Global Moderators
  • 7725 posts
  • Version:GM8.1

Posted 28 September 2011 - 07:39 AM

This is very easy and it's something I use a lot.

In the Create event of the title screen, define three global variables:
global.checkpoint =-1
global.sx = 0
global.sy = 0

When you collide with a checkpoint, let the player perform this code:
global.sx = x
global.sy = y
global.checkpoint = room

in the Create event of the player, also put this:
if(global.checkpoint == room){
  x = global.sx
  y = global.sy
}

Note: you might want to set global.checkpoint to -1 again when the player reaches the goal of the level.

If this helps you, please show me your gratitude by trying out my games ;)

Edited by Yal, 28 September 2011 - 07:40 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users