Android Question Display Sprite randomly

Discussion in 'Android Questions' started by herryj, Feb 3, 2015.

  1. herryj

    herryj Member Licensed User

    This may sound to lame for some experts, you guys. though forgive mi for I am still on the process of learning sprites.

    I have here an image attached below, I slice this images in another class, and now I want to display this sliced images randomly,

    can you give me any hint on how to do this or by giving a small code.

    I've done displaying random image though the image has its separate file name unlike to this one.

    Thanks for the advance help.

  2. walterf25

    walterf25 Well-Known Member Licensed User

    How do you slice the images?

    you could probably add the images to an array or a list and assign a number to each image.

    I would need to see more information on how you're doing this.
  3. herryj

    herryj Member Licensed User

    Hi Walter,
    Yes I added the image to an array.
    Here it is

    ' graphics Class module
    Sub Class_Globals
    Public eshp1(6As Sprite
    End Sub

    'Initializes the object. You can add parameters to this method if needed.
    Public Sub Initialize
    Dim est1 As Sprite
    0).Bitmap=est1.Bitmap : eshp1(0).Region(256,6,202,206) : eshp1(0).MidAnchor
    1).Bitmap=est1.Bitmap : eshp1(1).Region(6,394,117,102) : eshp1(1).MidAnchor
    2).Bitmap=est1.Bitmap : eshp1(2).Region(6,226,202,102) : eshp1(2).MidAnchor
    3).Bitmap=est1.Bitmap : eshp1(3).Region(137,394,100,102) : eshp1(3).MidAnchor
    4).Bitmap=est1.Bitmap : eshp1(4).Region(6,6,236,206) : eshp1(4).MidAnchor
    5).Bitmap=est1.Bitmap : eshp1(5).Region(222,226,168,154) : eshp1(5).MidAnchor
    End Sub

    I found some example here, though the image to be display randomly is only 1.

    For i=0 To 9
    Dim newAndroid As Sprite
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice