Sprite Swapping For Enemies VS Individual Objects

Discussion in 'Game Design, Development And Publishing' started by StuffMaker, Sep 9, 2019.

  1. StuffMaker

    StuffMaker Member

    Joined:
    Sep 8, 2019
    Posts:
    3
    I’m designing a platform game that will have different enemies depending on level/room and I was interested in whether just changing an object’s sprites based on the level/room was a potential way to go?
    For example: Each level/room would have an enemy that crawls back and forth along a platform and gives/receives damage the same way. I understand that I can make an “enemy” object for all shared enemy behaviors and then inherit that in a “crawler” object but was wondering if saying “this is room 5, so use sprites from spr_crawler_5 for obj_crawler” rather than creating an obj_crawler_5 explicitly?
    Performance issues on texture page swapping? Other potential gotchas with this process?
    Thanks!
     
  2. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,556
    I'd say the best approach is making multiple objects, using inheritance to only have the code in one object (parent_crawler has the crawler AI in its step event, etc) - it lets you fine-tune enemies later if you want to (e.g. their create events could be different so that one object sets its HP to 10 and another to 100, they could have additional code in its End Step event to create visual effects, e.g. fire crawler leaves fire trails...), and you don't need a horrendous 500-line logic to pick the right sprite based on the room.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice