Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

I had an issue where as soon as my player object collided with a tile, the object would instantly stick  and would not move with further input.  I was able to resolve this by putting "self." in front of the x and y values in the scripts.  Note, I did not modify the variables that started with an _, only the single character variables.

I did this for both the "tile_meeting_precise" script and the "movement_and_collision" script.

Works like a charm!  Thank you for the asset!

That is... a bit terrifying.  Putting "self" in front of anything shouldn't do anything.  Ever (outside of the context of a constructor, anyway).

Whoops, sorry! I didn't see a notification for your message previously.  I've since moved on to a different collision system for my current project as I couldn't get the collision just right for my needs (my project isn't a top down game, but I was trying to get the pixel perfect collision working for my platformer style game).


If I remember correctly, GMS2 was seeing x and y as a variable in the script, rather than the x and y instance variable of the object.  When putting "self." in front of it, the script found the calling object's instance variables and it worked as expected.  Maybe an update of GMS2 caused this?

Maybe?  That's why we usually declare vars as _x or _y instead of just x and y unless we literally want to deal with the calling instance's position.  Still feels unlikely, but as long as you got moving forward it really isn't important.

(1 edit)

I'm having this exact issue. This works perfect with the test square and it really is pixel perfect. However it prevents my player object from moving at all.


*editing because jump still works, but im sticking into walls and on floors. Last night I played with the player object mask and got it working with a detailed tileset, but switched to a simpler 32x16 block tileset today and this started happening. 

Just so I understand, the collision handling code you had previously that used place_meeting worked fine, but when you swapped to tile_meeting it started behaving badly?

This will be a difficult issue to resolve in this thread.  I would recommend joining the Game Maker Community Discord Server and asking there.  Most members are familiar with my system and could help you trouble shoot, and if I'm available, I'll help personally.  Here's an invite.

https://discord.gg/gamemaker

Thank you!

(1 edit) (+1)

I had this issue too, I only had to put self. in these sections of both the the tile_meeting and tile_meeting_precise scripts:

https://imgur.com/GdzjVHe

I also had to adjust the script some to include the whole wrapper for some reason, like this (with the end brace down at bottom ofcourse):

https://imgur.com/O89ztcH

I had to adjust the spr_wall_tile_frames origin to be Top-Left also.