Pygame map editor

Pygame map editor

Postby ChristianCareaga » Sun Jul 07, 2013 2:13 pm

im creating a map-editor (recreating) a map editor for an RPG and im recreating it because screen movement needed to be implemented so that we could make bigger maps

Im having trouble drawing hitboxes in the editor so basically in the editor when you push H a rect is drawn from the click point to the next selected click point
it works fine before you move the screen position but after it gets all messed up

so before i move a rect is created from where the mouse is to where the mouse is when i push H again
but when i move the camera say 20 pixels up the rect is blitted 20 pixels down where the mouse should be

the easiest way to understand is to run the code
here is a zip file
map editor
(28.14 KiB) Downloaded 140 times

or you can see the game with the mapeditor here:

please please help me out ive been trying to fix it for hours with no success thanks so much!
Posts: 54
Joined: Sat Jun 22, 2013 9:54 am

Re: Pygame map editor

Postby Mekire » Sun Jul 07, 2013 11:58 pm

I would like to help but honestly I'm not so sure what the goal is here. You are probably going to want to create a tile map editor, but your hit boxes should probably be masks--and they would probably be better handled with code. You can have a sprite sheet with all the available tiles on it. Then you place the tiles and keep track of their coordinates in a dictionary. You then make it so you can have multiple layers of these tile dicts for one map. You make masks of each layer and if the player is in that particular layer he collides with those masks.

New Users, Read This
  • Use code tags when posting code.
  • Include any errors with your post (in code tags).
  • Describe your problem; not your chosen solution.
  • Make examples the minimum length to demonstrate your issue.
User avatar
Posts: 1711
Joined: Thu Feb 07, 2013 11:33 pm
Location: Tucson, Arizona

Return to Game Development

Who is online

Users browsing this forum: No registered users and 4 guests