trying to fix a ¿bug? with kind of custom-collision shape

tabelortabelor Member Posts: 114
edited November -1 in Working with GS (Mac)
Hey there everyone!
I have a little ¿bug? with collisions in my mario bross game-like.
I'll explain what i'm trying: i want an actor to be able to walk above cubes like in mario brothers. I have a lot of cubes matematically placed and all with the same size and in the same Y axis/position, so, like in mario brothers.
The problem is when im walking above the cubes, sometimes the actor is stopped by one of these, so i think the problem is game salad is not 100%100 precise, so i'm trying to fix this.
Now I'll explain how:
first of all i want to tell than my collision shape is set to rectangle. All this can be fixed setting to circle, but with circle there is other problems, so for the moment i prefer to continue with rectangle and try to fix problems.

the method choosen to fix this problem is a very easy kind of custom collision shape. When i'm above the cubes, i want to set my mario-collide-with-the-cube to ON (a boolean) only when my actor is allready above one cube and he is walking to the next. The boolean it's a self atribute of each cube, so while Mario is above a cube with the collision boolean set to on, the next cube's boolean it's off and the boolean will switch to on only when mario is allready above him. This way, Mario can't be stopped by an unexpected collision (at least it should work like this i think...)
So i make a rule to set collision boolean to on only

if all conditions are valid:

Mario.Yposition + (Mario.size.height / 2) ≥ cube.Yposition+(self.size.height/2) //(i make sure mario is above the cube)
AND
Mario.Xposition + (Mario.size.width/ 2) < self.Xposition - (self.size.Width / 2) +10 //+10 is a margin

change Attribute
mario-collide-with-the-cube to false
And
display text: mario-collide-with-the-cube
The otherwise section is not necessary for what i want to report/ask

When mario is walking to the border of the cube, and the cube displays text : false (the boolean mario-collide-with-the-cube is false) mario should fall but it doesn'tm, why?
I would like to fix this problem but i don't know how to do it.
I also have another problem: this "antibug" rule work only when the speed is slow. If my actor is runing instead of walking, then the problem persist and it's stopped (sometimes, not allways) by the cubes.
Does anybody know how to fix this??
Thanks a lot for reading and sorry for my bad english

Comments

  • tabelortabelor Member Posts: 114
    In short: if i'm above an actor and the collision attribute is on and i switch it to off, the actor should fall. But it doesn't, the collision stands on even if the display text show that collision is false. The only way to make this actor to fall overlapping the actor is to jump or move him away of the actor, and then the next time he will touch the actor, he will not collide. What i would like is, when i set of the collision attribute i would like my actor falling through.
Sign In or Register to comment.