Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Problem with collision with map
- - By darkhog Date 2014-01-17 09:37
I have problems with collision with tile map. If player jump onto platform under "right" (or wrong, depending on point of view) angle, it ends up inside wall until he jump again. Not critical bug (player don't get "really" stuck or whatever), but it dpesn't look nice. To solve this issue, I wrote following snippet:

      if !no_ground?(@player.middle_x,@player.bottom) then
         @player.y -= (@player.middle_y / @tileset.tilesize).floor

(found at line 41 in code/Scene_Map.rb, commented out), but when it is enabled, it works (albeit with sliding instead of instant appear on top of tile), but character jumps around like he has an epileptic surge or something.
Parent - - By lol_o2 Date 2014-01-17 12:27
Try using some loop to make it instant.

Something like:
while !no_ground?(@player.middle_x,@player.y+31) do
  @player.y -= 1

It works, but bypasses @player.bottom, because it's not updating inside the loop. Just change it to your style of coding.
Parent - By darkhog Date 2014-01-17 16:38 Edited 2014-01-17 16:54
That for one thing. But how to make it not jump randomly when it shouldn't.
//edit: Nevermind, got it working, though it required bit more code and I'd rather not go with details.
Up Topic Gosu / Gosu Exchange / Problem with collision with map

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill