Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Changing sprite bimap on the fly — Gideros Forum

Changing sprite bimap on the fly

sdouglassdouglas Member
edited November 2011 in General questions
OK I give. I want to change the main player sprite image on the fly when a button is pressed . How can this be accomplished
Tagged:

Comments

  • atilimatilim Maintainer
    edited November 2011
    Hi,

    There is an button example coming with the installation:
    for windows: C:/Program Files/Gideros/Examples/Graphics/Button
    for mac: /Applications/gideros ..../Examples/Graphics/Button

    It contains a generic button class (button.lua) for everyday use. You can look at main.lua to understand how to use it.

    ------------------------------------------------

    To change (or animate) the sprite image, you have 3 options:

    1. removeChild the old bitmap and addChild the new bitmap. Bird Animation example demonstrates this method.
    2. add all bitmaps as children and call setVisible(false) for all of them then setVisible(true) for the bitmap you want to display.
    3. Use the MovieClip class. Assume that you have 3 frames. Construct a MovieClip as:
    local mc = MovieClip.new{
        {1, 1, frame1}, 
        {2, 2, frame2}, 
        {3, 3, frame3}, 
    }
    and use MovieClip:gotoAndStop(frame) function to go to a specific frame.

    http://www.giderosmobile.com/documentation/reference_manual_2011.9.html#MovieClip


Sign In or Register to comment.