Endless background concept - nothing works

Hi all!
I am really stuck here. I have tried to build a game where my character actor moves up and to the side and the "camera" follows, so that he is back in the middle of the screen.
After moving, the actor spawns a new background actor. Then i use a boolean attribute to trigger the movement of the main actor and all background actors.
They should move exactly the opposite direction and same distance that the main character has moved before, but no matter what I do, it moves much further. What's more, after the first time, only some spawned backgrounds move, and no matter what i change in the scripting, the preview won't change.
Is there a better way to achieve this?
Here is the project: https://db.tt/2tEkSAG5
Thanks in advance for your help!

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @Lacina said:
    Hi all!
    I am really stuck here. I have tried to build a game where my character actor moves up and to the side and the "camera" follows, so that he is back in the middle of the screen.
    After moving, the actor spawns a new background actor. Then i use a boolean attribute to trigger the movement of the main actor and all background actors.
    They should move exactly the opposite direction and same distance that the main character has moved before, but no matter what I do, it moves much further. What's more, after the first time, only some spawned backgrounds move, and no matter what i change in the scripting, the preview won't change.
    Is there a better way to achieve this?
    Here is the project: https://db.tt/2tEkSAG5
    Thanks in advance for your help

    The question is a little confusing (to me at least) and your link is a 500 byte (half a k !) blank text file

  • LacinaLacina Member Posts: 5
  • RossmanBrothersGamesRossmanBrothersGames Member Posts: 659

    it would be easier if you explained what you were trying to accomplish, what do you mean by endless background?

  • LacinaLacina Member Posts: 5

    I thought I was:

    I want my main actor to move along a floor and never reach an end. If the move was right, I want the camera to follow, so he is back in the center (eg floor and actor move). If the move was wrong, i want the actor to return to the center so the player can try again (main actor moves, floor does not).

    Is that any clearer?

  • joshiwujoshiwu Member Posts: 207

    well then you need to take a class in animation.

  • LacinaLacina Member Posts: 5

    @joshiwu said:
    well then you need to take a class in animation.

    Em? The question is not how to animate the character, but how to achieve the effect that the character can move endlessly in any direction.

  • nir3112nir3112 Member, PRO Posts: 312

    If you want your player to move right and the screen will never end what you need to do is using a simple code here is a tutorial hope this is what you mean:

  • LacinaLacina Member Posts: 5

    thanks @nir3112, but I don't know how to adopt that for my project. I need two situations:

    1.) The background stays put and the main actor moves somewhere

    2.) Background and main actor move synchroneously so that the main actor returns to his original position.

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291

    @Lacina said:
    I thought I was:

    I want my main actor to move along a floor and never reach an end. If the move was right, I want the camera to follow, so he is back in the center (eg floor and actor move). If the move was wrong, i want the actor to return to the center so the player can try again (main actor moves, floor does not).

    Is that any clearer?

    It is still not clear what you are trying to achieve.It's hard for any of us to get a clear picture in our heads on what you are trying to accomplish here so it is hard for us to help you. I am confused in the above quote you posted because first you say, "(eg floor and actor move)." but then at the end you say, "(main actor moves, floor does not)." You don't clearly explain what you are wanting or how the game play works.

    Maybe since you are having trouble explaining through text, maybe make a video explaining what you are trying to accomplish and upload that. Just an idea.

  • RossmanBrothersGamesRossmanBrothersGames Member Posts: 659

    @Lacina
    I looked at your project last night and still couldn't figure out.
    But now after your last explanation i think I see what you mean. You want the actor to make a move, then you want the appearance of the camera moving to that location centering the actor. And from the look of your project this is not a sidescroller but top down where it has the main actor able to move by the x and y coordinates. So here is my thoughts on how to best accomplish this.

    First you only want the background moving when you are moving the actor back to the middle so you need an boolean attribute to let it know when to do that. Looks like you already have that.

    Second, in order to get the actor and background actor to move perfectly together you need to constrain the backgrounds x and y, to the characters x and y when you want them to move together.
    So you will need to make two game attributes, one to constrain the actors x and one for his y.
    Then the background will need an equation to determine where it is in relation to the actors x and y so that it moves accordingly. So the background will need two attributes to determine the initial difference of its x and y coordinates from the main actor's. This needs to happen after the main actor has done its initial move, and before it moves back to the center.

    Actor.x-Background.x=Difference.x

    Then while they are moving back constrain Background.x to Actor.x-difference.x
    do the same for y.

    I know it is confusing but that logic should work.

Sign In or Register to comment.