Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Deleting an event from the game map using RGSS

I have an interesting problem. I have managed to add events through RGSS using the following code

Code:
ev = RPG::Event.new(x, y)

    ev.id = $game_map.events.size + 1

    ev.pages = []

 

    # Create a game event object using map id and ev value 

    event =  Game_Event.new($game_map.map_id, ev)

    event.through = false

 

    # Set the event at ev.id to our event (include it in map)

    $game_map.events[ev.id] = event

    @index = ev.id        

    #$event_instance[ev.id] = event

    #$game_map.map.events.keys.push(@index)

    $game_map.map.events[@index] = ev

    #print $game_map.events

 

    # Map needs to be redrawn because a new event was added

    $game_map.need_refresh = true

    $scene.spriteset.add_additional_sprites

Now I wish to do the opposite and remove events from the game map using RGSS. I have taken the straightforward approach and used the line $game_map.events.delete(index). This remove the event but not the corresponding sprite. I suppose I could set the event sprite to a blank before erasing the event, but is their a more thorough way to remove the event sprite?

Thanks for the help.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top