1

I am making a small game for my AP Econ class and have been following a tutorial to create a tile map and am having difficulty with collisions. I have searched through the questions on this site as well as anywhere else that I could find programming related questions (Primarily here) but have not been able to find any that are don't have a map built by hand (Building a map by hand in a text document or directly in the python file with a list). I am new at python so the answer might be fairly straight forward XD.

Main Program: https://pastebin.com/VbGVzJab

Textures: https://pastebin.com/iTBpiub3

Colors: https://pastebin.com/ywMKv6Z1

Globals: https://pastebin.com/E40a7Kss

Map_Engine: https://pastebin.com/PJgnSFJP

Map_Editor: https://pastebin.com/mvgaYBDF

Tutorial I have been following: https://www.youtube.com/watch?v=sxk4Oi9QOrM&t=997s

This is how my folders are set up:

My issue is that I my character (player) continues to walk instead of stopping at the water (Or whichever tile type is designated (In my case it is currently water). Thank you all in advance!!

1 Answers1

0

I don't know if this will help, but you can try either making movement variables to signal if the person can move that way, and when you come across that area of coordinates (the water), you can set those coordinates to False. If you made coordinates (x and y to move your character), it shouldn't be hard.

Please note I'm just using a random coordinate area

MOVE_RIGHT = True
MOVE_LEFT = True
MOVE_UP = True
MOVE_DOWN = True
if x == 250:
    MOVE_RIGHT = False
if event.key == K_RIGHT and MOVE_RIGHT == True:
    x += 1

Hope this helps!

  • Thank you for the input but, I am trying to use the Blocked_At function I have in Textures to block off all the same tiles (So as to avoid having to manually input the location of each tile). When printing the Blocked variable (In Textures) I see the location of the the tiles, they just are not stopping the character. – Jason Weidman May 16 '18 at 17:00