Need help with Gameover scene please? :)

allc1865allc1865 Member, PRO Posts: 777
edited October 2013 in Working with GS (Mac)
Hello everyone! :) I need help with my gameover scene ;) When my actor dies, the game over picture comes up, but only in one area. I wanted it to show up wherever the player is. Also, when the game over scene shows up, you can still use the controls to shoot and move, even though the actor has been destroyed. Any help would be appreciated! :) Thanks :)
Here's the link to my template: :)
https://www.dropbox.com/s/bicm3ervqd8ho3f/GameOver scene Template.zip

Best Answers

«1

Answers

  • allc1865allc1865 Member, PRO Posts: 777
    @timolapre1998, thanks for replying! That worked thanks! :) Another problem is that my game over picture only appears on one place, so if my player is somewhere else, when he dies, you won't see the picture. Any way to fix this? Thanks :)
  • -Timo--Timo- Member Posts: 2,313
    you can constrain the game over picture with the player maybe? as I am not on windows I cant play your game so I don't know how you are doing the game over ;)
  • allc1865allc1865 Member, PRO Posts: 777
    I'm on Mac ;) I did also try contraining the picture to the player, didn't work though :) Thanks
  • allc1865allc1865 Member, PRO Posts: 777
    constraining* :)
  • -Timo--Timo- Member Posts: 2,313
    edited October 2013
    I am so stupid :D change your picture so I know who you are ;)
    I always open the wrong project for some reason. I don't know why. maybe I am just stupid?
    you probably wont believe it but I just went to my windows xD I will look at it when I am on mac and when my homework is done... (and my sister is now on mac :( )
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @allc1865 When something seems like it should work but doesn't, the best course of action is to post a screenshot (see my signature for instructions) of the rule you're having trouble with.

    In this case, my guess is that you have set the position of the game over actor to relative to scene instead of relative to actor, but I won't know for sure until I see your rule.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • -Timo--Timo- Member Posts: 2,313
    edited October 2013

    In this case, my guess is that you have set the position of the game over actor to relative to scene instead of relative to actor, but I won't know for sure until I see your rule.
    thats a good guess ;)
    you are spawning the game over actor relative to scene. just change this the position offset to X = 0 and
    Y = 0 and relative to scene.
    you also want to put the behavior change self.rotation to 0 inside the game over actor

    PS when you download the project on windows its a windows project. when you download on mac its and mac project. just noticed that and this wasnt before ;) not sure if this also works backwards

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
    @allc1865 Why don't you just have, if player dies is true, change image??? Just a thought.
  • allc1865allc1865 Member, PRO Posts: 777
    Ahhh, yes. That was my problem. I had my X and Y set to something other than 0. Also, as @tatiang said, my position of the game over actor was relative to scene instead of relative to actor... That works now. But here is what I'm trying to get it to look like: when your pplayer dies, the game over menu shows up where, and would say like, retry, menu, etc.
    Right now, where ever the player is, that's where the menu shows up as shown below:
    image
    It is over in the right hand side of the screen where the actor was instead of centered; how I want it to be :)
    Here's my actor player rules:
    image
    ....
    and here's the rules for my game over actor:
    image

    Thanks, everyone! :) ;)
  • allc1865allc1865 Member, PRO Posts: 777
    I wanted it to show up centered on the screen is what I meant :) ;)
    @timolapre1998, thanks for your help, that worked! :)
    @KillerPenguinStudios, hi, thanks for the reply. That is a good idea, however I think I would run into one problem which what I'm having trouble with now, getting my game over picture to be centered ;) :) Thanks! ;)
  • -Timo--Timo- Member Posts: 2,313
    you can make another scene with the game over image and buttons to go to menu, retry etc.
    you have to make a integer attribute.
    when player dies
    do
    pause game (scene game over)

    when player menu is pressed change integer to 1
    unpause game.

    when retry button is pressed change integer to 2

    inside the player (or something else inside the play scene)
    if integer is 1 change scene to menu

    if integer is 2 reset scene.

    hope this helps :)
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Ihowever I think I would run into one problem which what I'm having trouble with now, getting my game over picture to be centered ;) :) Thanks! ;)
    To centre an actor/image it's just a case of saying

    self.position.X = game.Screen.Size.Width / 2

    And it's the same vertically:

    self.position.Y = game.Screen.Size.Height / 2
  • -Timo--Timo- Member Posts: 2,313
    edited November 2013
    Ihowever I think I would run into one problem which what I'm having trouble with now, getting my game over picture to be centered ;) :) Thanks! ;)
    To centre an actor/image it's just a case of saying

    self.position.X = game.Screen.Size.Width / 2

    And it's the same vertically:

    self.position.Y = game.Screen.Size.Height / 2
    thats not possible as the scene is bigger then you can see. he is using control camera.
    your player is always in the middle and you have in the player if health = 0 spawn actor game over. so then he is in the middle?
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    thats not possible as the scene is bigger then you can see. he is using control camera.
    your player is always in the middle and you have in the player if health = 0 spawn actor game over. so then he is in the middle?
    I won't lie, I didn't read the posts above the one I commented too.

  • allc1865allc1865 Member, PRO Posts: 777
    @KevinCross, thanks for your reply! :) Would that be a change attribute behavior? My game over attribute is a boolean, so I couldn't do the "=". Thanks again :)
  • allc1865allc1865 Member, PRO Posts: 777
    @timolapre1998, yes, I could do a change scene, but I kind of wanted it to appear on the same screen :) I may just change scenes though.
  • -Timo--Timo- Member Posts: 2,313
    you also can put it in one scene.
    you just have to play wth the values though.
    if player health = 0
    do
    spawn actor, menu button
    x -200 y -100 relative to actor ;)
    spawn actor retry button
    x 200 y -100 relative to scene

    and just in the buttons what you want to do.
    if touch is pressed go to menu or restart scene :)
    hope this helped
  • KevinCrossKevinCross London, UKMember Posts: 1,894

    thats not possible as the scene is bigger then you can see. he is using control camera.
    your player is always in the middle and you have in the player if health = 0 spawn actor game over. so then he is in the middle?
    @allc1865 if the scene is bigger than the screen like @timolapre1998 says, and the player is always in the middle of the screen because it controls the camera, can you not spawn the game over image/actor in the same position as the player?

    And yes I was referring to change attributes in my example above. Those two change attributes would go on the game over actor when it's spawned or you could just put the second part of each (the game.Screen.Size.Height & Width part) on the Spawn Actor behavior, depending on what spawns the game over actor.
  • allc1865allc1865 Member, PRO Posts: 777
    @KevinCross,

    ...can you not spawn the game over image/actor in the same position as the player?
    Yes, but if my actor is at the right hand side of the screen, then my game screen would show up there, to the right of the screen. : )
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Fair enough, I'ma leave this thread now to those that have read it all. Good luck!
  • allc1865allc1865 Member, PRO Posts: 777
    Thanks for your help :) ;)
  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
    Hey @allc1865, The reason I suggested to just have, if player dies is true, change image is because in your post you said, "I wanted it to show up wherever the player is." :D lol
    Well if you are controlling the camera try this. Have your game over image in your scene somewhere where it's not seen during gameplay.

    In the game over attribute, give it a Start X and Start Y integer.
    Tell the object to change Start X to self.position.X
    and Change Start Y to self.position.Y

    (This next part must be done by unlocking the actor in the scene)
    In a rule: When game over is true
    Change self.position.X to camera X
    Change self.position.Y to camera Y

    Otherwise:
    Change self.position.X to Start X
    Change self.position.Y to Start Y

    This is just a thought off the top of my head as I am not 100% sure how your game works! :D Let me know how that goes!
  • allc1865allc1865 Member, PRO Posts: 777
    @KillerPenguinStudios, okay. So I have the gameOver picture in the seen out of the way so it can't be seen during gameplay.
    I went into the attributes panel (not the attributes in the actor itself) and made two integer attributes called Start X and Start Y. I went into the gameOver actor and said change attribute > game.Start X to self.Position.X
    Then I made another change attribute and said > game.Start Y > self.Position.Y
    Then I went into the gameOver actor in the scene - unlocked it and said > Rule > when game.GameOver is true > change attribute self.Position.X to scene.Camera.Origin.X;
    change attribute > self.Position.Y to scene.Camera.Origin.Y
    otherwise > change attribute > self.Position.X to game.Start X;
    change attribute > self.Position.Y to game.Start Y.

    Is that right?
    Thanks :) :)
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    That looks close. The camera origin is at the bottom-left of the scene. If you want the center of your game over actor to be in the center of the scene, you'll need to add half the scene's width and half the scene's height to your camera origin x and y, respectively.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
    edited November 2013
    That looks close. The camera origin is at the bottom-left of the scene. If you want the center of your game over actor to be in the center of the scene, you'll need to add half the scene's width and half the scene's height to your camera origin x and y, respectively.
    Oh yes, forgot to add that in there. Was doing 100 different things when I was typing that up so it's understandable I would have missed something. :p HAHAHA
    @KillerPenguinStudios, okay. So I have the gameOver picture in the seen out of the way so it can't be seen during gameplay.
    I went into the attributes panel (not the attributes in the actor itself) and made two integer attributes called Start X and Start Y. I went into the gameOver actor and said change attribute > game.Start X to self.Position.X
    Then I made another change attribute and said > game.Start Y > self.Position.Y
    Then I went into the gameOver actor in the scene - unlocked it and said > Rule > when game.GameOver is true > change attribute self.Position.X to scene.Camera.Origin.X;
    change attribute > self.Position.Y to scene.Camera.Origin.Y
    otherwise > change attribute > self.Position.X to game.Start X;
    change attribute > self.Position.Y to game.Start Y.

    Is that right?
    Thanks :) :)
    The StartX and StartY go in the Game Over actor. I threw a quick demo together for you to check out. Hope that helps! :D
  • allc1865allc1865 Member, PRO Posts: 777
    That's a good demo, thanks. But I think my problem is the spawn actor in my player actor. I have when my health bar is 0, spawn actor gameOver in front of actor relative to actor.
    I think that's why my gameOver image shows up wherever my actor is...
    image
  • -Timo--Timo- Member Posts: 2,313
    edited November 2013

    you also want to put the behavior change self.rotation to 0 inside the game over actor
  • allc1865allc1865 Member, PRO Posts: 777
    Okay, that works. Thanks, @timolapre1998. I don't want to be difficult, but it's still not in the center when my player dies.
    image
Sign In or Register to comment.