Ruby Tutorial 3 - Classes/Methods/Inheritance

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
2,925
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 17, 2011

In this tutorial we cover some of the basics of creating new classes how to define methods and inheritance. I say in the beginning that we will also do aliasing, but I didn't end up getting to that. But no worries, we will in my next one!

In this tutorial we covered some of the basics of creating a new window/scene, a little about input and putting them all together.

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (gubid)

  • class Window_Mine < Window_Base def initialize super (0,0,320,240) actor = $game_actors[1] x, y = 5, 50 draw_actor_face(actor, x, y) end

    end

    class Scene_Mine < Scene_Base def start @my_window = Window_Mine.new end  def update @my_window.update if Input.trigger?(Input::C) sound.play_decision $scene = Scene_Map.new end

    It's telling me I have 'wrong number of arguments (0 for 4)' on line 11

    which is '@my_window = Window_Mine.new'.

  • @diamondandplatinum3 Looks like you have an extra space between super and the ()'s. If you space, then it assumes you are going to pass each argument that way.

  • @gubid Ugh, im such an idiot. Thank you anyways.

  • @Yandrox14 As I have said, spelling errors are the most common errors you will encounter. I wish you the best of luck with your project.

  • @gubid Sorry, last post was a mess >_<. So I get NameError on line 16. unitialized constant Scene_Mine::Imput. The script:

    class Scene_Mine < Scene_Base def start @my_window = Window_Mine.new end def update

     @my_window.update if Imput.trigger?(Imput::C) $scene = Scene_Map.new end end def dispose @my_window.dispose end

    end

  • @Yandrox14 imput is not the module, its Input with an N. That would be why you get the error.

see all

All Comments (20)

Sign In or Sign Up now to post a comment!
  • godlike

  • @gubid

    +1 to that. I was struggling with an error and all I was missing was the word 'end' that I had forgotten to write in twice.

  • @gubid Thank you! Now I can get into the game. But as soon as I talk to the NPC, I get an error: Script 'Tutorial 2' line 16: NameError occurred. uninitialized constant Scene_Mine::Imput. class Scene_Mine < Scene_Base def start @my_window = Window_Mine.new end def update @my_window.update if Imput.trigger?(Imput::C) $scene = Scene_Map.new end end def dispose @my_window.dispose end end
Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more