Solid Map Objects

The last thing left on my list before being happy with the movement drawing was the characters interaction with the map objects. Previously, the Character Sprite was drawn after the Map Objects and so would run straight over them. Not Good. So what I’ve done is added another attribute to the input file “Solid”, if this is the case, and if a movement in a given direction would cause the character’s Rect would collide with the Map Object’s Rect, the movement function isn’t called. Thus making the object appear solid.

canmove = True
if movekey[K_LEFT]:
for image in self.thismap.grids:
if image.getSolid():
if image.rect.collidepoint(self.char.rect.centerx – 10,            self.char.rect.centery):
canmove = False
if canmove:
self.char.move(“left”)
self.Scrolling(“left”)
self.drawMap()

Next, I think, I’d like to develop the Character. It may just be a matter of an arbitrary event that gives +10 HP or whatever, and stores for further use.

I’ve also renamed the main file from gametest to nsf0.1, and will keep versions from now on. I’m tempted to use CVS, but it’s just another thing to learn, and my learning list is a little full right now.

Advertisements

One Response to “Solid Map Objects”

  1. Your blog is interesting!

    Keep up the good work!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: