Hey, I love using Ruby btw!
I'm trying to figure out the Ruby for scene changes using Shinycocos.
The code from the Monocle Studios tutorial is (in summary):
-(void)startGame: (id)sender {
GameScene * gs = [GameScene node];
[[Director sharedDirector] replaceScene:gs];
}
The code I have so far is (Using template):
class DemoScene < Cocos2D::Scene
include Cocos2D
def initialize
@sprite = Sprite.new("menu.png")
@sprite.position = [240, 160]
@numSprite = Sprite.new("fps_images.png")
@numSprite.position = [240, 100]
@label = Label.new("I wrote this in RUBY! Mwahahahaha!", "Arial", 20)
@label.position = [240, 200]
@menu = MenuItemImage.new(:normal => "textup.png", :selected => "textdown.png")
@listMenu = Menu.new(@menu)
add_child @sprite
add_child @numSprite
add_child @label
add_child @listMenu
# Director.add_touch_handler(self)
# end
# def touches_ended(touches)
#// move the sprite to the touched part, with a "Move To"
# @sprite.run_action Actions::MoveTo.new(1.0, Director.convert_to_gl(touches.first[:location]))
# end
end
end
class FollowScene < Cocos2D::Scene
include Cocos2D
def initialize
@gsSprite = Sprite.new("game.png")
@gsSprite.position = [240, 160]
add_child @gsSprite
end
end
Cocos2D::Director.set_orientation Cocos2D::Director::ORIENTATION_LANDSCAPE_RIGHT
Cocos2D::Director.run_scene DemoScene.new
So what I'd like to do is have the @menu item be clicked upon and then go to "FollowScene". I'm not new to Ruby, but I am new to Cocos2D. I love the whole scene/layer approach and am very excited to learn as much as possible!
Thanks for your help in advance!
-SS