Trouble with Transferring Movement

Hi. I'm making a labyrinth-style game where the player uses the accelerometer to control a ball and ultimately reach the end part of a level. After watching this video () I thought I'd be able to transfer motion easily from one scene to the next.

Here's my problem: the entrances and exits that vary from scene to scene are not 'clean'. By this I mean that the exit of one scene does not always evenly line up with the next scene's entrance. However, they are always on the appropriate side (for example, if I exited a scene from the right side of the screen, I would enter somewhere on the left side of the screen into the next scene, but not on the same location on the X or Y axis). This design was on purpose, as I don't want the player to just assume where they are entering the next scene.

Here's my question: how do I fake it? How do I transfer the velocity of the player object from one scene into the next? I hope I'm making sense, but I'll admit I'm a beginner to GameSalad (though not to game development).

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    What have you tried? I would think that something along the lines of

    When attribute scene.completed=true --> change attribute game.velocityX to self.motion.linear velocity.x; Otherwise --> change attribute self.motion.linear velocity.x to game.velocityX

    might work.

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

  • aduroanimusaduroanimus Member Posts: 5
    Apologies in advance, but I don't really understand "scene.completed = true". Do I have to make new attributes labeled 'scene' and 'completed'? Both of which would be boolean?

    Here's what I tried to do (in theory), but it ended up just crashing the game. Essentially, I was trying to 'save' the velocity of the player and then take the same velocity and implement it at the beginning of the next scene. So:

    collide with exit -> save velocity -> open next scene -> player velocity = saved velocity.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Sorry, I was just illustrating that you could use a scene attribute, but a game attribute works fine (e.g. a boolean called game.LevelCompleted, initially set to false).

    I'm not sure why it crashed the game. Can you post a screenshot of your rules? And can you try it without saving/loading attributes? Try my suggestion if it makes sense now.

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Here's a demo.

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

  • aduroanimusaduroanimus Member Posts: 5
    Alright, with your demo, I feel like I'm finally getting somewhere. But, as always in game development, fix one bug and create five more. The problem I'm having now is that it's always putting the player actor in the same position upon entering every new scene, rather than coming out of the actual entrance. The majority of the time, this is a game-breaking bug, as I will have another object already where the player actor is spawning.

    Would it be possible to zip up the game so far and show you the player actor rules? They're rather long and complex, as they also include interactions with other mechanics.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    In my demo, I just retain the Y value and reset the X value to 0 so that it appears to wrap from the right side of one scene to the left side of another. I thought that's what you were going for, but if you have a specific entrance on each scene, then you would just change the Y value to where the entrance is.

    You're welcome to .zip the file and send me a download link via PM (or post it here). I can't promise I'll look at it immediately but I'll see what I can do.

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

  • arrowmax08arrowmax08 Member Posts: 4
    Anyone got a demo .zip file like the game in the youtube video?
Sign In or Register to comment.