costum cursor for rmxp(rgss)

what do you think of this toturial?

  • great

    Votes: 9 90.0%
  • bad

    Votes: 1 10.0%

  • Total voters
    10

Blizzy

me = Scripter.new("Noob")
  • 492
    Posts
    20
    Years
    ok, here's a toturial i just wrote for costum cursors in rmxp(rgss)
    Code:
    # costum cursor, rgss (code + explanation)
    # by Virtual
    # movement:
    # option 1, option 2
    # option 3, option 4
    
    class Scene_Cursor
      def main
        @cursor = Sprite.new #initialize the cursor.
        @cursor.bitmap = RPG::Cache.picture("cursor name") #picture of the cursor.
        @cursor.x = 0 #this is the x coordinate of the cursor.
        @cursor.y = 0 #this is the y coordinate of the cursor.
        @cursor.z = 999 #layer of the cursor, could be anything from 1 to 999
        
        Graphics.transition
        loop do
          Graphics.update
          Input.update
          update
          if $scene != self
            break
          end #if statement
        end #loop
    
        @cursor.dispose #erase the cursor if scene closes.
      end
      def update #update the scene
        @cursor.update #updates the cursor
        if Input.trigger?(Input::UP) #if keypress is up
          if @cursor.y == 0 
            @cursor.y -= 0 #if cursor.y = 0, it's won't go up
         else
            @cursor.y -= 32 #moves the cursor down
          end
        end
        if Input.trigger?(Input::RIGHT) #if keypress is right
          if @cursor.x == 64 
            @cursor.x += 0 #if cursor.x = 64, it's won't go right
          else
            @cursor.x += 64 #moves the cursor to the right
          end
        end
        if Input.trigger?(Input::LEFT) #if keypress is left
          if @cursor.x == 0
            @cursor.x -= 0 #if cursor.x = 0, it's won't go left
          else
            @cursor.x -= 64 #moves the cursor to the left
          end
        end
        if Input.trigger?(Input::DOWN) #if keypress is down
          if @cursor.y == 32 
            @cursor.y += 0 #if cursor.y = 32, it's won't go down
         else
            @cursor.y += 32 #moves the cursor down
          end
        end
        
        # for the next part, the hardest,
        # you can better look at the attachement
        # https://www.pokecommunity.com/attachments/17990&stc=1&thumb=1
        if Input.trigger?(Input::C) #if keypress is C (which is "accept")
          if @cursor.x == 0 and @cursor.y == 0 #option 1
            print "option 1"
          end
          if @cursor.x == 64 and @cursor.y == 0 #option 2
            print "option 2"
          end
          if @cursor.x == 0 and @cursor.y == 32 #option 3
            print "option 3"
          end
          if @cursor.x == 64 and @cursor.y == 32 #option 4
            print "option 4"
          end
        end #keypress
        if Input.trigger?(Input::B) #keypress is X (which is "close")
          $scene = Scene_Map.new #return to map
        end #keypress
      end #method
    end #class
    the best way to read this is to put it in rmxp's script editor
    (so the comments are green, and easier to understand)

    to call it, paste this in a call script:
    $scene = Scene_Cursor.new

    comments & questions are welcome
    *tested & it works fine!

    hope you guys like it!
    ;)

    --Edit--
    small bug found + fixed
    return to map is now possible!

    maybe the file in the attachement gives an idea what it is
     
    Last edited:
    Nice work there.. ( not that i?ve tested it, but i will!)
    Cool idea.
     
    Last edited:
    thanks for the comments...
    i really appriciate it ;)

    this kind of "cursor moving" could be used in the battle.

    comments & questions are welcome
    suggestions too

    i added a poll, to see if my toturial is really worth it
    if it's good, i might make some more
     
    Last edited:
    Back
    Top