我正在使用鞋子编写赛马/投注游戏,我想知道如何在不同的代码区域更改 GUI。当我运行它时,我在一个应用程序上获得马,然后在另一个应用程序上获得比赛线,但我希望它们都在同一个应用程序上。我是否需要将实际的 Shoes 应用程序本身设置为变量?
class Horse
def initialize()
#puts "YOYOYOYO"
#@number=i
Shoes.app{
@icon= image 'horsey.jpg'
@icon.left = 100
@icon.top = 50
}
end
def neigh()
#puts "Neighhhh"
end
def raceTime()
time=rand(100)%20
return time+10
end
end
class HorseIcon
def initialize(h)
@horse= h
@imageloc='horsey.jpg'
end
end
class Game
def initialize(h1, h2)
contestants=[h1, h2]
Shoes.app{
@icon= image 'raceline.jpg'
@icon.left = 100
@icon.top = 70
}
end
def race()
end
end
game= Game.new(1,2)
seabiscuit= Horse.new()