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.

New Mode7 script / Neo Mode 7 script

I didn't manage to obtain the problem with the water until now...

I made a compatibility script for the ring menu, it shall be pasted below the mode7 and ring menu scripts :

Code:
# Compatibility Mode7 - Ring_Menu
# 26/03/08 - MGCaladtogel
# this script must be below the two other scripts
#------------------------------------------------------------------------------
#  Window_RingMenu
#------------------------------------------------------------------------------
class Window_RingMenu < Window_Base
#------------------------------------------------------------------------------
#  Initialize
#------------------------------------------------------------------------------
  alias initialize_RingMenu initialize
  def initialize( center_x, center_y )
    if $game_system.mode7
      x_intermediate = center_x + 15
      y_intermediate = center_y + 24 - $game_temp.pivot - 4
      if $game_system.loop_y
        h = 32 * $game_map.height
        y_intermediate = (y_intermediate + h / 2) % h - h / 2
      end
      center_y = (($game_temp.distance_h * y_intermediate *
      $game_temp.cos_angle).to_f / ($game_temp.distance_h - y_intermediate *
      $game_temp.sin_angle) + $game_temp.pivot)
      center_x = 320 + ($game_temp.slope_value * center_y +
      $game_temp.corrective_value) * (x_intermediate - 320)
      if $game_system.loop_x
        offset = ($game_map.width >= 24 ? 64 * ($game_temp.slope_value * center_y +
        $game_temp.corrective_value) : 0)
        l = 32 * $game_map.width * ($game_temp.slope_value * center_y +
        $game_temp.corrective_value)
        center_x = (center_x + offset) % l - offset
      end
      center_y -= 32 * $game_player.height * ($game_temp.slope_value * center_y +
      $game_temp.corrective_value)
      center_x -= 15
      center_y -= 24
    end
    initialize_RingMenu( center_x, center_y )
  end
end

#------------------------------------------------------------------------------
#  Game_Map
#------------------------------------------------------------------------------
class Game_Map
#------------------------------------------------------------------------------
#  Name
#------------------------------------------------------------------------------
  def name
    $map_infos[@map_id]
  end
end
#------------------------------------------------------------------------------
#  Scene_Title
#------------------------------------------------------------------------------
class Scene_Title
  $map_infos = load_data("Data/MapInfos.rxdata")
  for key in $map_infos.keys
    $map_infos[key] = $map_infos[key].name
  end
end
#------------------------------------------------------------------------------
#  Sprite_V
#------------------------------------------------------------------------------
class Sprite_V < Sprite
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    square_y_corrected = square_y
    y_intermediate = 32 * y_map - $game_temp.pivot - $game_map.display_y / 4
    y_intermediate_reference = y_intermediate
    if $game_system.loop_y
      y_intermediate = (y_intermediate + $game_temp.height / 2) %
      $game_temp.height - $game_temp.height / 2
      if y_intermediate_reference < y_intermediate
        square_y_corrected = square_y + $game_map.height
      elsif y_intermediate_reference > y_intermediate
        square_y_corrected = square_y - $game_map.height
      end
    end
    self.y = ($game_temp.distance_h * y_intermediate *
    $game_temp.cos_angle).to_f / ($game_temp.distance_h - y_intermediate *
    $game_temp.sin_angle) + $game_temp.pivot
    if y < $game_temp.height_limit
      self.opacity = 0
      return
    end
    self.opacity = 255
    if !$scene.is_a?(Scene_Menu) and $scene.spriteset != nil
      opacity_values = $scene.spriteset.tilemap.opacity_values
      tone_values = $scene.spriteset.tilemap.tone_values
      if opacity_values.has_key?(y)
        self.opacity = opacity_values[y]
        self.tone = tone_values[y]
      end
    end
    self.zoom_x = $game_temp.slope_value * y + $game_temp.corrective_value
    self.zoom_y = zoom_x
    x_intermediate = 32 * x_map - $game_map.display_x / 4
    self.x = 320 + (zoom_x * (x_intermediate - 320))
    if $game_system.loop_x
      offset = ($game_map.width >= 24 ? 64 * zoom_x : 0)
      l = 32 * $game_map.width * self.zoom_x
      self.x = (self.x + offset) % l - offset
    end
    self.z = (128 * square_y_corrected - $game_map.display_y + 3) / 4 +
    32 + 32 * priority
    return
  end
end
 
Thank you very much, the Ring_Menu compatibility works :thumb:! You are the fastest person i've seen working with compatibility nice job. Also it works very well, never above the screen, perfect position. I just know I will be able to make it compatible now, before I had absolutly no faith.

EDIT: Just a suggestion here in the next version you should also slant the fog that way the fog isn't rolling in the sky but nearer to the ground to make it more realistic.

EDIT2: I have another error, this one is wierd. If I walk to a certain distance on my map it teleports my off the map and I walk into the water then I jump out of the water (Jump is a Blizz-ABS feature) and if I do it again same error. Also this is the in the water error (I cannot enter the water unless I go off of the map). Hope this info helps.

P.S.: When off the map your are uncontrollable and are forced back into the water.

Here are two screenshots:

http://img502.imageshack.us/img502/5686/mode7offmaperrorqc2.th.png[/img]
One step away from vertically teleporting.

http://img502.imageshack.us/img502/7554/offmap2qp9.th.png[/img]
Off map automatically walking toward the on-map.
 
evilbob -> all consecutive tiles with the same terrain tag are considered as a unique vertical sprite.
With this configuration :
http://img141.imageshack.us/img141/7845/m702nr6.png[/img]
we obtain only one vertical sprite :
http://img141.imageshack.us/img141/7654/m701sf0.png[/img]

If I add a third terrain tag to specify vertical elements (script l. 57) :
Code:
$terrain_tags_vertical_tiles = [1,2,3]

and if I define these terrain tags (to avoid consecutive rows of tiles with the same number) :
http://img141.imageshack.us/img141/1302/m703dp9.png[/img]

the problem is solved :
http://img141.imageshack.us/img141/2447/m704fh0.png[/img]


diablosbud -> could you PM me a demo with your map ?
 
yes you fixed the bug with animating tiles. theirs still a few bugs with it ieaving pixels beihind when changing slope of mode 7 in an event or something.
 
Is it possible to disable the script on a map ingame? I know it is probably not possible on the fly, but perhaps disable it so that when the map is reloaded it is back to normal?
 
I posted a new version :
You can disable mode 7 for maps with mode7 settings thanks to a switch.

L. 69 :
Code:
# enable/disable mode7 for mode7 maps (not on the fly, just when the map is loaded), enabled by default
$enable_mode7_number = 5 # switch number : change this value !

Just replace the value by your switch number.

I also fixed a scrolling bug when the player is transfered to a new map, and modified the mode7_set_p function to have all the sprites refreshed during the slants changes.
 
I just thought about something for... please don't hurt me :tongue: rotation! You said you would need a method to rotate bitmaps? Then maybe you could use poccil's "simple and fast" way to get bitmap data. You will have to write the code in C and compile it into a dll though. I'm sure it's worth a try :smile:

Take care!
-Dargor
 
To set player's height :

Part 2, l. 214 (in Game_Character), replace :
Code:
attr_reader  :height
by :
Code:
attr_accessor  :height

Then just use the following command in an event:
Code:
$game_player.height = N
where N is the height value (you can use floats)
 

Khoa

Member

Thank you for your GREAT help (^^)
EDIT: I want to redraw the map with the new angle and the angle is stored in a variable, how to do that?
 
i found a bug when i tried to set autotiles to 1 (Note : my autotile is mountain), when i place 'em then i see a bit strange, the mountain is vertical not in mode 7 a bit strange indeed, 2nd :  can you somehow reduce the lag?. Thanks in advance
 

boon

Sponsor

This is a very good script! The only problem is that it's pseudo-3D, the buildings are super flat, stuck upright. :dead:

Oh well, you can't do anything about that in a 2D game maker :P
 
iqbal_0k, Gangstaquay5000 -> if you use two similar mountain autotiles, one set to 1 and the other set to 2, and then you place them in alternative rows, this should result in a better rendering.



I made some tests with Poccil's method to obtain map rotation for a mode 7 script.
The framerate is quite good with a recent computer, but it falls with older computers.
So I tried to reduce lag lowering the screen's resolution, and then refreshing only half of the pixels each frame (called "filter" in the script).

You can see the result by yourself : http://www.mediafire.com/?0ug2zud3gdz

No feature is implemented, there is just the map.
You can test with 3 different resolutions, with the "filter" or not.
Press C to go ahead, Left and Right to rotate the map.

I will try to release a new version based on this test script if I got positive feedbacks.
 

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