Quote from: M3T41 AG3 on June 19, 2010, 07:10:19 pm
class MYTH_MAIN
def initialize(menu_index=0)
$menu_index = menu_index
end
def main
$battlebackground = Sprite.new
$battlebackground.bitmap = Bitmap.new("Graphics/Battlebacks/#{$game_map.battleback_name}")
$battlebackground.x = 0
$battlebackground.y = 0
$battlebackground.z = 101
$battler = []
@icon = []
$enemy = []
for i in 0...$game_party.actors.size
$battler[i] = Sprite.new
$battler[i].bitmap = Bitmap.new("Graphics/Battlers/#{$game_party.actors[i].battler_name}")
if i == 0 then
$battler[i].x = 10
else
$battler[i].x = $battler[i - 1].x + 150
end
$battler [i].y = 100
$battler [i].z = 101
@icon[i] = ICON.new
@icon[i].x = $battler[i].x + 10
@icon[i].z = 102
end
Graphics.transition
loop do
Graphics.update
Input.update
#update
for i in 0...$game_party.actors.size
@icon[i].update(i)
end
if $scene != self
break
end
end
Graphics.freeze
end
end
class ICON < Window_Selectable
def initialize
super (1,100,20,20)
end
def update (i)
if Input.trigger?(Input::A)
print i
end
end
end
im trying to get the icons to display the action menu (not yet coded) that has all of the actions/commands you can use in battle and form there im just going to let the default battle system take over.
I'll take a look here. At a glance, though, why do you have all the global variables? It would be better to make them public instance variables and create attr_accessors if you need to access them outside the class.
You also do need not set the x and y. Each is 0 already unless it is otherwise defined.
Also, it is not good to have much more than Graphics, Input, and the normal update in the main loop. I see you have the update commented out and have other stuff in there. Just put the other stuff in the update method, and write it like this:
@icons.each {|icon| icon.update}
Check the help menu chapter Enumerable to learn more about that. Once you properly learn how to use iterators, it will open up a lot of different things that you can do. I'll look at this a little more in a little bit and get back to you.