Jump to content


Photo

Objects Should Disappear/ Checkpoints


  • Please log in to reply
11 replies to this topic

#1 AffectedPestilence

AffectedPestilence

    GMC Member

  • New Member
  • 16 posts

Posted 12 October 2008 - 03:52 PM

Hi,
some questions here ..

1)I have a little problem with objects. For example, I set an life object and take it. If I die, the room should be
restarted but the object should be gone because I took it already. How to make the object disappear for the rest of the game if I took it ??

2) I' m wondering how to create Checkpoints during the game. When the character dies
he shouldn't restart the whole room but start from the checkpoint .

need answers ...
  • 0

#2 Barrel_Roll

Barrel_Roll

    GMC Member

  • New Member
  • 156 posts

Posted 12 October 2008 - 04:31 PM

I'm not sure about the second question. But if you use a GML script, you can set the destroy_object to global and it should stay.

It should probably look like this. global.destroy_object()

I am 84% sure that will work.

Please feel free to correct me.

Edited by Barrel_Roll, 12 October 2008 - 04:34 PM.

  • 0

#3 ragarnak

ragarnak

    GMC Member

  • GMC Elder
  • 19468 posts
  • Version:GM8

Posted 12 October 2008 - 04:38 PM

How to make the object disappear for the rest of the game if I took it ??

You have multiple options there.

I would suggest you do not destroy the player, but just move it, when it gets killed, back to its starting-position :
:(
X: xstart
Y: ystart

(eventually you can reset the player by creating a new one at those "xstart" and "ystart" coordinates and destroy the old one)

2) I' m wondering how to create Checkpoints during the game.

When you use the above method (with those "xstart" and "ystart" variables) you could, when your player collides with such a waypoint-object, just copy the current "x" and "y" into the "xstart" and "ystart" variables.

Hope that helps.
  • 0

#4 AffectedPestilence

AffectedPestilence

    GMC Member

  • New Member
  • 16 posts

Posted 12 October 2008 - 04:42 PM

Hmm...
I don't feel safe to use scripts ^^
I have no experiences with scriptz and cannot work with them, for sure :(
  • 0

#5 Rainsong

Rainsong

    GMC Member

  • New Member
  • 157 posts

Posted 12 October 2008 - 04:44 PM

1. I would create a global like maybe global.lifeObjectDisplay, have it set to true right when the game begins (say, creation code of title/menu room). Then, when it runs out, set it to false.

For the life object's event
If global.lifeObjectDisplay = false
{ instance_destroy() }

(I'm not gonna use a codebox for just 2 lines. >.>)

---

2. Maybe use a checkpoint object like the lamp posts in the sonic games. When the player collides with it, make an event that plays a 'checkpoint' sound, animates it a bit, and sets player coordinates.

Like, say, if you put the checkpoint at 1299, 583 then put in the CHECKPOINT's collission event (in caps because its important):

global.playerRespawnX = x
global.playerRespawnY = y

Then, in whatever event you have for player death (just use the room's creation code if death means room_restart() )

player.x = playerRespawnX
player.y = playerRespawnY

That'll put the player (if that's the player object's name) where the checkpoint is if he/she touched it before.
The ONLY thing I can think of that might be bad about this is that one can hit checkpoints out of order and that'd hurt more than help them.

(Guh... so many replies while I was posting. x_x; Well, now's a good time to learn, anyway. I would say implement the first one in code just to get used to it, seeing as it only takes like 2 or 3 lines. ^_~ )

Edited by Rainsong, 12 October 2008 - 04:46 PM.

  • 0

#6 Barrel_Roll

Barrel_Roll

    GMC Member

  • New Member
  • 156 posts

Posted 12 October 2008 - 04:44 PM

Hmm...
I don't feel safe to use scripts ^^
I have no experiences with scriptz and cannot work with them, for sure :(


There may be a D&D equivalent, but I'm not going to look for it.

I'd listen to ragarnak, his thing will probably have less room for error than mine.

Edited by Barrel_Roll, 12 October 2008 - 04:46 PM.

  • 0

#7 AffectedPestilence

AffectedPestilence

    GMC Member

  • New Member
  • 16 posts

Posted 12 October 2008 - 05:09 PM

The idea with the Posted Image (xstart , ystart )
is nice but when the player dies there is no transition and it looks not good. Can I make a transition effect by myself or
do I need to have the Pro Edition ??? :(
  • 0

#8 ragarnak

ragarnak

    GMC Member

  • GMC Elder
  • 19468 posts
  • Version:GM8

Posted 12 October 2008 - 05:20 PM

Can I make a transition effect by myself or

Ofcourse you can ! Even with the "light" version you can make all sorts of effects. Maybe not all of them, but several nonetheless. :(
  • 0

#9 Chris32

Chris32

    GMC Member

  • New Member
  • 14 posts

Posted 27 October 2008 - 02:20 AM

I dont know about the fist one, but #2 is easy.

Object: character
Collision with checkpoint = save game, destroy object
button (your choice) = load game
OR
do the save game part, but instead you can do....
collision (object) = LIVES (Relative) -1, if lives is lower than 1 load game

I hope this helps!!!
- Chris32
  • 0

#10 pandavenger

pandavenger

    GMC Member

  • New Member
  • 8 posts

Posted 13 July 2009 - 10:01 PM

And you call yourselves intermediate users! Just set the room to persistant so it'll stay the same always when you reenter/restart it. When the player beats the game just restart the game, the hiscores will still stay there but the rooms will be reset! There!
  • 0

#11 ragarnak

ragarnak

    GMC Member

  • GMC Elder
  • 19468 posts
  • Version:GM8

Posted 14 July 2009 - 03:35 AM

And you call yourselves intermediate users!

The last time I called myself that is a long time ago. ;)

Just set the room to persistant so it'll stay the same always when you reenter/restart it.

Doesn't that ("stay the same always") mean that the the dead player will stay where it is too, and won't be set back to its starting position ? :)

And a remark : didn't you notice that the question is about 8 months old (meaning that probably nobody will be looking for a solution anymore) ?
  • 0

#12 kmcatie

kmcatie

    GMC Member

  • New Member
  • 2 posts
  • Version:Mac

Posted 04 April 2013 - 09:53 PM

Hmm...
I don't feel safe to use scripts ^^
I have no experiences with scriptz and cannot work with them, for sure dry.gif

I'm the same way. Im so confused :yucky:


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users