LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



View previous topic View next topic Go down Message [Page 1 of 1]

Administrator
Administrator
#1 RMXP = Event Gravity (GPLAT 2 of 2) Empty RMXP = Event Gravity (GPLAT 2 of 2)
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
I know, I've gone platformer crazy! :~p

so much has been learned and discovered
these past few years and lots will be fine tuned, polished and shared.

I've came across a lot of platform scripts for RMXP, usually it's just a script that makes the player jump and only move left to right, but what about the enemies, items, and other events?

Here's a short but sweet script made to give that platform project the gravity it needs. Try it with any platformer script or it with the Pixel Platformer (GPLAT 1 of 2) pixel movement and gravity for the game_player ^,^

enjoy ~

RMXP - EVENT GRAVITY v1.0

Code:
#===============================================================================
# Event Gravity script by G@MeF@Ce "GPLAT 2 of 2" http://www.gameface101.com
# special thanks to mr_wiggles for RGSS support
# free to use, must give credit, do not post on any other site
#===============================================================================
module G_EG
 
GPLAT_SWITCH = 1    #switch ID to turn on/off event gravity
 
G_GRAVITY = 1      # Y coordinates to
 
G_DROP = 30        # speed of gravity pull
 
end
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event < Game_Character
include G_EG
  #--------------------------------------------------------------------------
  # ● Frame Update
  #--------------------------------------------------------------------------
  alias gravity_update update
  def update
      #check_jump_event if $game_switches[GPLAT_SWITCH_ID]
      gravity_update
      if $game_switches[GPLAT_SWITCH] and $game_map.passable?(@x, @y+1, 2)
        @y += 0# if @icon_name != nil
        unless @id > 999 or @air_event or @fixed_event
          @y += G_GRAVITY
        end
      end
  end
 
  #--------------------------------------------------------------------------
  # ● Refresh
  #--------------------------------------------------------------------------
  alias refresh_gravity refresh
  def refresh
      refresh_gravity
      unless @page == nil
          for i in @page.list
              if i.code == 108 or i.code == 408
                # Code for Air event
                if i.parameters[0].upcase[/AIR/] != nil
                    @air_event = true
                end
                # Code for Fixed event
                if i.parameters[0].upcase[/FIXED/] != nil
                    @fixed_event = true
                end
              end
          end
      end
      if @air_event and $game_switches[GPLAT_SWITCH]
        if @y != @old_y
            case rand(6)
              when 0..2; turn_right
              when 3..6; turn_left
            end
            @old_y = @y
        end
      end
  end
end
     
#==============================================================================
# Game_Character
#==============================================================================
  class Game_Character
 
      def update_move
          distance = 2 ** @move_speed
        if @y * 128 > @real_y
          @real_y = [@real_y + distance, @y * 128].min
          # event gravity
        if self.is_a?(Game_Event) and $game_switches[G_EG::GPLAT_SWITCH] and
          @air_event == nil
          @real_y += G_EG::G_DROP
        end
        end
            if @x * 128 < @real_x
              @real_x = [@real_x - distance, @x * 128].max
            end
            if @x * 128 > @real_x
              @real_x = [@real_x + distance, @x * 128].min
            end
            if @y * 128 < @real_y
              @real_y = [@real_y - distance, @y * 128].max
            end
            if @walk_anime
              @anime_count += 1.5
            elsif @step_anime
              @anime_count += 1
            end
          end
    end
#end of script ^,^

screen_shot?
Spoiler:

*a special thanks to our mr_wiggles
for making this possible.
Administrator
Show Signature
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#2 RMXP = Event Gravity (GPLAT 2 of 2) Empty Re: RMXP = Event Gravity (GPLAT 2 of 2)
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
Looks nice, i see you used proper indentation.
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#3 RMXP = Event Gravity (GPLAT 2 of 2) Empty Re: RMXP = Event Gravity (GPLAT 2 of 2)
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
wiggles! ha I'm glad you finally took a look, yeah as a noob scripter, I would never care for proper indent, now it's a must.

again, thanks for your help with this one.

I clicked the ["Thanks"] button. Cool
Administrator
Show Signature
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 1]

 

Chatbox system disabled
Personal messaging disabled