#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Platformer game problem

Posts: 151Member, PRO

So I have a ground actor that spawns itself to the right for 1.5 seconds exactly on the same y coordinate but different x coordinates. (So a line like this ---------.) But as the actor walks on it he sometimes gets caught on an edge that's not there. Any help?
Like this dot: ______._______ , but the line is, but definition, straight.

• Posts: 11,288Member, Sous Chef, PRO, Senior Sous-Chef

For starters, I would put a Display Text with self.Position.Y on the ground actors and the main character actor and see if the value varies at all. Could it be possible that the main character actor moves slightly up or down? Is bounciness set to 0 for both types of actors?

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

• Posts: 1,471Member, PRO

Try setting the bounciness of the actor to 0.08 , or any small value that wouldn't effect the gameplay. The slight push from the bounciness will allow the actor to pass the edge without getting stuck.

• Posts: 151Member, PRO

I tried the display value of y coordinates and there was no change when I got stuck. I will try the low bounciness and see if that works. Thanks!

• Posts: 151Member, PRO

I still got stuck.

• Posts: 151Member, PRO

I mean, how else do platformer programmers make a long line of tiles? Instead of putting the tiles 1 by 1, I want to make them quick, (and it works all right.) Replicate sadly does not mimic attributes. Any help?

• Posts: 1,471Member, PRO

Can you share your movement rules ? How are you moving the player ?

• Posts: 353Member, PRO

@Twayne2 said:
I mean, how else do platformer programmers make a long line of tiles? Instead of putting the tiles 1 by 1, I want to make them quick, (and it works all right.) Replicate sadly does not mimic attributes. Any help?

Hey, I just finished my platformer.
The app is currently under review on iOS and I am waiting for the release.

As I started, I encountered similar problems as you have.
I have set tiles of 64x64px. This is a lot of work and after the first level I had the problem that my actor not only needs the floor, but also walls.
So my Actor don´t collide with the Block-Tiles, but with a second floor, called Ground. And there is another actor, called Walls.

Therefore, I can set my tiles as I would like and does not have to pay attention how they line up.

In the scene it looks like this...2 Layers
1. Tiles (visible)
2. Ground/ Walls (Change Alpha to 0)

Then you put the Actor Ground behind your visible tiles.

And what I would recommend to you, create your own CollisionShape for your character. With this you can already solve a few more problems.
With it, my Player works with bounciness "0"

Here is a video of my Platformer, which will hopefully be found in the store in the next few days.

Daniel

• Posts: 151Member, PRO
edited March 5

But that is more work. Lol. I use the change linear velocity behavior.

• Posts: 1,471Member, PRO
edited March 4

@Twayne2 said:
But that is double the work. I use the change linear velocity behavior.

Use constrain linear velocity instead , then try setting the bounciness to a low value, try 0.1 or 0.09 , play with the value.

• Posts: 151Member, PRO

So if right arrow is pressed, constrain instead of change? Would constrain go through the edge? I will try it out sometime today.

• Posts: 1,471Member, PRO

Yes constrain instead of change , and don't forget to set the bounciness to a low value,try and tell me if it works

• Posts: 151Member, PRO
edited March 5

Shoot, I forgot to try it out. I don't think it will work, but if I remember to I will post here the results if I try it today.

• Posts: 151Member, PRO

Somehow, in some way, your solution worked!!!!!!!!!!!!!! Thank you so much!!!!!!!!!
1 awesome coming up!

• Posts: 1,471Member, PRO

Awesome , glad it did thank you

• Posts: 151Member, PRO

Oh no! While I was playing it started again! It was after added a timer to something that had not even happened yet... weird. Anyways, after I got rid of the timer, for now it is working. Why? I hope it will not happen again. Is 500+ tiles in one scene too many? (I am guesing the amount, I really don't have an accurate count.)

• Posts: 1,471Member, PRO
edited March 8

@Twayne2 said:
It was after added a timer to something that had not even happened yet... weird. Anyways, after I got rid of the timer, for now it is working. Why?.....

If it only happens after you add a timer to something that had not even happened yet , then this timer to something must be the cause to your issue, you must do something about it. You should re structure your code break it down into small logic blocks and try to figure out why this timer to something is breaking everything.

• Posts: 151Member, PRO

I think it will still happen, but who knows. I hope not.