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.

Transferring the player to a specific map from a script

I don't have the code handy right now, I've got the beginnings of a world map system, using a series of images, but the main part I'm interested in is basically:

Code:
if this key is pressed

   if this location is highlighted

      move player to specific map

Obviously $scene = scene_map.new takes me back to the map that the world map was called from, which is fine if all I'm doing is looking at the world map then leaving, but not really what I'm looking for.
 
Try checking out how the transfer map function was handled in the Interpreter. Its different depending on whether you have XP or VX, but the end result is the same, and all the relevant code is in that one function.
 
I've found the function in the interpreter, but I'm not sure how I can replicate that that in another scene, say if I want to switch from map 1 to map 2 when A is pressed.
 
the "A" key is the X button, so...
In the update method, add

Code:
    if Input.trigger?(Input::X)

      $game_temp.player_transferring = true

      $game_temp.player_new_map_id = 2

      $game_temp.player_new_x = 12

      $game_temp.player_new_y = 7

      $game_temp.player_new_direction = 2

      Graphics.freeze

      # Set transition processing flag

      $game_temp.transition_processing = true

      $game_temp.transition_name = ""

    end
 

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