I'll just post the scripts, since you probably don't have RMXP.
There are some references to database defined variables in the mapping stuff, and the input module is part of the built-in RGSS extension, but it's rather straightforward. The input functions:
Input.update - captures input state
Input.trigger(key) - returns true if the key is pressed in this frame but not the previous frame
Input.dir4 - returns one of the following (corresponds to num pad directions):
0 no direction
2 down
4 left
6 right
8 up
Input.press(key) - returns true if key is pressed during this frame
The Sprite class (some of my classes inherit from it) is built in and has the following:
Properties:
bitmap - the sprite's assigned texture
src_rect - a rect (x, y, width, height) within the bitmap from which to get the image
x, y, z - screen coordinates of the sprite, screen is 640 x 480
mirror - boolean value used to flip the image
Methods:
new(viewport) - class constructor method
dispose - disables the sprite and actively frees any resources it was using (rather than waiting for garbage collector)
update - updates built-in 'flash' effect. I don't think I used this, but I may have
I think that's all I used from Sprite.
Graphics.update - renders all Sprite and Plane objects according to their current states, in the order they were created. Waits for vsync and flips screen
General Ruby notes:
Ruby uses the $ prefix for global variables and the @ prefix for object-local variables.
attr_reader is a macro to allow an object variable to be read from outside the class by calling it as a method:
attr_accessor is the same, but allows the variable to be modified as well
class Test
attr_reader :var #without this line the variable is private
def initialize #defines the constructor (method gets internally alised to 'new')
@var = 3
end
end
temp = Test.new
p temp.var #prints out '3', the value of the object's @var
Ruby inheritance is done during class declaration, ie:
class ChildClass < SuperClass
starts defining a class called ChildClass that inherits from SuperClass. If a method in ChildClass has the same name as a method in SuperClass then it can call the method 'super' in order to invoke the same method within the superclass.
class Animal
def report
print "This is an animal."
end
end
class Dog < Animal
def report
super #invokes the 'report' method of the superclass, 'Animal'
print " It is a dog."
end
end
temp = Animal.new
temp.report #prints "This is an animal."
other = Dog.new
other.report #prints "This is an animal. It is a dog."
If there's anything else that's confusing I can explain it for you.
I've just plucked the scripts out and pasted them into a file. Since it's small I'll include the project itself as well in case you want to get the RMXP trial version or something and check it out. Here's your link:
http://mayobe.webs.com/mario_rmxp.rar