collision

i create collision for the game but its making the gameplay bad. when it come in contact with the obstacles the whole game flcikers and flickers. sometimes it moves, flcikers and goes back to the spot it was before. what do i do.

mega.co.nz/#!jd82yYxC!aokl2LFfp … bVPRkDHDkE
decryp key: !aokl2LFfpm456PrDbvQEBnk7McH81jebkbVPRkDHDkE (if it doesnt work delete exclamationmark at the beginning)

do you have multiple images for both the sprite player and the sprite/ object you are colliding with? i found so far that if the size of the images are out by a few pixels it makes judder. . look at the size of the object images. in the end i had a few images which were a few pixes smaller so i made them bigger and i get nice fluid movement now. my problem was not 2 game objects colliding but it was the main character and the floor object. But its worth a look at it this way :slight_smile:

i made the floor obeject slightly bigger does dat mean im going to have to change all of the back to original sizes

no its not about say an object that has 1 image for animation. im saying that if you have an object with multiple images for its animation make sure they are all the same height and width(walking, standing idle and jumping) . you can edit the collision mask to suit the largest pixel parts of your image after :slight_smile: i was doing victors tutorial with the aliens on platformer style game and found the animations for walking and the ones for standing still were about 5 pixels out in height so this caused a little judder. i know the artwork is Kenney’s artwork so its not artwork at fault from victor.
Victors tutorial has made the most sense so far out of the ones i have tried. :slight_smile:

send me a friend request over and send me the art images u have used which are jumping when they collide i will check the size of each of them for you if you do not know how :slight_smile:

I think it a bug in the web platform as if I change the platform to native and run preview it works fine. I don’t experience that the player is “changing” it position on collision. Also tried pixel perfect collision, but that’s not the problem, so it probably a bug somewhere in the web platform that 4ian need to check.

Regarding the “flickering” screen, that’s because you center the camera on the player, well not on the player but on an object (VisionA) that X,Y position is equal to player X,Y so the result is the same, and so when you collide with an object the player object is moving little bits back and forth that the camera is follow and that’s what you actually see and make the screen “flickers”. To solve the problem, just simply center the camera on VisionA only when the player is not colliding with an obstacle. To do that, just copy the collision check condition, change Soldiers to 1psoldier and invert it to be true and center the camera only if 1psoldier is not in collision with obstacles.

where do you want me to paste the collision condition, i pasted in where i put the conditions for visionA. i inverted the condition and and changed it to 1psoldier. but i dont know what event makes the “center camera only if 1psoldier is not in collision with obstacles”

PS btw when i said changing position i meant the enemy (idk if you can see him) sorry, so can i do nothing about it?
fyi the version that is the one b4 the newest. and do i delete the other collision condition with soldiers on it

If I read it correctly, you invert the collision detection, so VisionA will follow 1psoldier only if it isn’t colliding with obstacles, then you allways center the camera on VisionA. It will work as you expect, since the camera will follow 1psoldier through VisionA, but when 1psoldier collides, VisionA stop following it and the camera stops too, until 1psoldier doesn’t collide anymore :slight_smile:

If you only use VisionA for this, you can avoid this “link” between Camera-VisionA-1psoldier, just center the camera on 1psoldier while it doesn’t collide with obstacles :wink:

no… what meant is how do i make it center on the camera only if 1psoldier is not in collision in obstacles

cos i did everything else but it’s still not working

I meant exactly what Lizard is saying. If you have used the collision check condition and invert it in the event to center camera, then technically you center the camera only if the player is not colliding with obstacle as the action run only if the condition is true . In this case the condition is "If 1psoldier is not in collision with obstacles " and the action is “Center camera on VisionA”. If you put it together you get “center camera only if 1psoldier is not in collision with obstacles”
If it doesn’t solve your problem then maybe I misunderstood what you meant by “the game flickers”. I thought you mean the actual screen of the game is shaking “flickers” when player is in collision with an obstacle.

Regarding that player object is jumping and changing it position on collision, change the platform to native and run a preview to make sure I didn’t misunderstand this part is well.
If the problem is not present in the preview of native platform (on my side seems like it not), then it probably a bug in the web platform as all the events should work the same on both platform without require any changes. If it a bug you can’t do anything about it at this point other then use the native platform until it get fixed in the web platform.

this is what i meant by flickering

mega.co.nz/#!CA1g2QbA!8JK2Jgz7H … SYjVSKg6AI
key:8JK2Jgz7HnBFIAAzq6Ah47dcGvjyE1Cz1SYjVSKg6AI

i did what you told me n its still happening. i think its like david gould said it suttin to do with the object size
idk how to convert to native platform

Yeah I was completely misunderstand this “flickering” problem, I though you have 2 problems 1.the player is jumping and the screen flickering… Anyway what you just show me on the video, I don’t experience it in native platform.
To change platform, open “extensions” and on the top you can see the platforms- Right click on “Native Platform” and choose “Use this platform” then right click on “Web Platform” and choose “Do not use this platform anymore”. Close the window, Close your scene then reopen your scene and run preview which should open inside GD as a native preview this time.

thanks, i converted it. n i guess the juddering is tolerable. it doesnt really happen. maybe it is a bug. should i report it?

thanks i sorted it out. the problem was actually the collision mask. if the collision masks are inconsistent it will make the player to move away further than its supposed to.

i have pointed out previous that the collision mask needs a zoom feature. which would stop this from happening. i tend to leave the bottom of the character flat on all the sprites as then it does not cause an issue.
as it was a mask issue remember to keep an eye on the height of sprites in the animation also as this can cause the same problem. all i do is take the image size of the biggest animation and make all the others the same size transparent background :slight_smile: then i mask the top right and left side if the bottom of the item is constant collisions with the floor.