Player not respawn, but moving back to the startpoint

MarcoColMarcoCol Member, PRO Posts: 279
edited August 2012 in Working with GS (Mac)
Hi,

i want that if the player lost a live, he moves back to the start point in the level (moving with a constant speed). So the startpoint is in each level the same.
So if i use
"Change Attribute" = Lifes -1, then move to
doesn't work

Comments

  • StoneclipseStoneclipse Member, PRO Posts: 130
    try using change attribute self.position x and self.position y back to the starting x and y coordinates.
  • ChobbifaceChobbiface PRO Posts: 491
    edited August 2012
    I would record your player's starting position into an attribute 'self.startX' and 'startY' if needed. Then rule, if attribute Lives <0, change attribute position X/Y to 'startX'/'startY'
  • MarcoColMarcoCol Member, PRO Posts: 279
    I set the both attributres for the startposition. Then if an opponent collide with the player, the attributes of his position change with them of the start.
    All attributes are (real).
    But it doesn't work.
    Also I didn't want, that the actor will respawn at the starting point. He should move (fall down) to the starting point.
  • ChobbifaceChobbiface PRO Posts: 491
    edited August 2012
    @MarcoCol When you say it doesn't work, are you saying it's not resetting to the starting positions at all or it's not working how you want it i.e. not moving down to starting point gradually. If the latter, use the interpolate position X/Y, rather than change attribute.

  • MarcoColMarcoCol Member, PRO Posts: 279
    without moving a few pixels from current position, nothing happens (few = 1-3 pixels). So if the scene ist for example 1500 px high, can the player also fall down to the set pixel position? I set the position with "change attribute" when start the level, right?
  • ChobbifaceChobbiface PRO Posts: 491
    edited August 2012
    Well 2 ways - with your self.startX and self.startY attributes, either
    1) Type in what you want the figures to be directly in the attribute or
    2) Change these attributes self.startX and self.startY to self.positionX and self.positionY of your actor right at the beginning of your rules (these will record the starting position of your actor)

    And yes, if the scene is 1500px high, it can fall down to the set pixel position if you use interpolate
  • MarcoColMarcoCol Member, PRO Posts: 279
    So. i worked on it and now it works better. But all the time, the player falls only back to the X-Position that was set.
    I have a vertical scroller, and made it without the Control Camera, with moving th ebackground. So if I am on position for example 330, then the player doesn't fall back to 160 of the scene.
  • LumpAppsLumpApps Member Posts: 2,881
    Could it be that the actor still has a velocity? Try this:
    Move atribute:
    Angle: [doesn't matter what]
    Speed: 0

    Then use 2 interpolate attributes:
    Interpolate: self.position.X
    to startX
    Duration: [for example 1 second

    Interpolate: self.position.Y
    to startY
    Duration: [for example 1 second]

    Hope that helps.
  • MarcoColMarcoCol Member, PRO Posts: 279
    Well, it works a half, thank you.

    But the player doesn't fall back to the point of the scene.

    So for clarify:
    I set up the scene with a height of 1500 px.
    So the startpoint is 160x160 px.

    I add four buttons for moving. Each change an attribute, when tapping.
    In the player actor, there is then the command if attribute has the direction, then move to the direction.
    I didn't change anything in the player-actor velocity.
    Also i didn't use the ControlCamera...

    Maybe I do something wrong?
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    The problem is you didn't use the camera control so I assume your actor basically stays in the same area of the screen which is why it only moves a few pixels. So what you need to move is the background and objects that make it appear like the scene is changing not the player.
  • MarcoColMarcoCol Member, PRO Posts: 279
    Oh yes, that was my problem ...

    Now it works generally. But the fall-speed should also be the same. Even if I am for example 300 or 1000 Pixel high. How can I do that?
    Also my player ist just going each time a bit high, till he reach the camera-rectangle. But I want, that if he moves high, only the background moves and if the player moves right and left, then he should move (what he still do...).
  • MarcoColMarcoCol Member, PRO Posts: 279
    I must change the view of the game, because of the collision with enemies. So now the player don't move anymore, but there will be played an animation of moving and the backgrounds moves. So I have 4 the same backgrounds (each approx. 1000px high; Scene is approx 5500px high) and one above who moves, which works good. But I stil want, that the player "falls" down when collide with an enemy. I tried it on the same way, but it doesn't work. So now the backgrounds must move all together up (with the same speed) to simulate, that the player is falling down. Did you have an idea for the how to fix this?
  • MarcoColMarcoCol Member, PRO Posts: 279
    I can't fix it, so I will don't put in the falling after loosing a life.
Sign In or Register to comment.