Jump to content

morgans303

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by morgans303

  1. Generally, the more intuitive the design is, the easier it is to add things to it without breaking other things. Keeping the player still and moving everything else on the stage seems like a really unintuitive workaround to me.

    I've never really used pygame, so I don't know what functionality it gives you, but in standard OOP design, these are the objects I'd have for this:

    Camera - invisible object who lives just to keep track of what the offset in the room is to draw everything. The other objects are draw with respect to this, and the background can simply be offset by the camera's x/someScale, y/someScale.

    Player - the human player, who moves based on keyboard input, and draws itself at its current x,y position each frame.

    Enemy - same concept as above, moves around and draws itself.

    Does that make sense? If you have a sample of the code, it'd be a lot easier to explain that way.

    Helpful. I'll have to research how to go about this in Python. There's a shortage of Python game development tutorials for sidescrollers.

  2. Ok, so I kinda screwed this up.

    I achieved background scrolling by keeping my character at a fixed point, and moving the background. It worked fine, until I added an patrolling enemy.

    He syncs with the background when standing still, but I haven't figured out how to make him patrol without falling out of sync with the level. One possible solution is to add collidable objects, but then he'd behave more like a lemming.

    Is there a better solution?

×
×
  • Create New...