SceneA goes to SceneB - 1 actor randomize image each time?

StormtrixStormtrix Member Posts: 256
edited November -1 in Working with GS (Mac)
Morning,
Tried to follow Tshirt's demo of 5 cards randomized and one of the posts on the forums but don't think they quite apply to the problem i'm having.

Scene A has button -- push button goes to Scene B.
Just want Scene B to come up with 1 of 10 images randomly. when done with image
go back to Scene A -- hit button again goes back to Scene B and gives a different image from the possible 10... rinse and repeat.. that's it.

any ideas?
thank you.

Comments

  • CatOnAKeyboardCatOnAKeyboard Member Posts: 39
    You need an invisible actor that picks a random number 1-10, and then has 10 rules, each spawning a different actor based on the value of that random number. It's a lot of grindwork, but it can be done.
  • StormtrixStormtrix Member Posts: 256
    Thanks for the replay Cat...

    Here's what i'm trying.
    First i have game attribute 'loop' (real) and 'number' (integer)

    In invisible actor... (found part of this from Jhaas's post 5 months ago)

    Change Attribute: game.loop To: ((game.Time*100)-(floor(game.Time)*100))/50
    Constrain Attribute: game.loop To: game.number

    Timer
    For: game.loop run to completion

    Rule
    Attribute: game.number = 1
    Spawn Actor: image1

    then i would do 9 more rules for if number =2 then spawn actor 2 and so on?
    maybe i'm just not creating the random number right :)

    Storm
  • StormtrixStormtrix Member Posts: 256
    Thanks tshirt for the example, checking it over now.
    I'm trying to apply it to an example of like flash cards.
    So, if i have 10 flash cards - and the image of card 1 is a 1, image of card 2 is a 2, etc.. up to 10. I would create integer game attributes for each like your stages? card 1, card 2, card 3?
    again, only trying to get 1 random card to be displayed per game.

    then where would i spawn the card image? after the scrubbing part on the 'continue' actor?

    thanks for the help btw.. i'll be done with my app if i can just iron this out.
  • StormtrixStormtrix Member Posts: 256
    holy cr%pola, i got it.... thanks to your post like this one i found that you did tshirtbooth --

    Make a controller in the scene, its an object you cant see off to the side.

    Add these rules

    change attribute game.object to random(1,12)

    rule
    If game.object = 1
    spawn object1 (choose the position you want relative to scene.)

    rule
    If game.object = 2
    spawn object1 (choose the position you want relative to scene.)

    rule
    If game.object = 3
    spawn object1 (choose the position you want relative to scene.)

    woohoo.. :) thanks again for the support. will post app when finished.
  • StormtrixStormtrix Member Posts: 256
    hmmm.. problem has occured :)
    So, i have my app done, signed up on dev site and published my app to my phone.
    The scene i have and controller i'm using to randomly pull a card is taking 20sec just to show a card.. seems rather long.
    in my controller all i have is --

    Change Attribute: game.card To: random(1.52)

    Then i have 52 rules :)

    Rule1
    Attribute: game.card = 23
    Spawn Actor: 2ofclubs

    Rule2
    Attribute: game.card = 7
    Spawn Actor: 5ofhearts

    and so on - not duplicating numbers.
    20 seconds for it to run through this on my 3G phone.
    anyway you optimize this type of randomization?

    Storm
  • StormtrixStormtrix Member Posts: 256
    nope..

    rough numbers..
    17 seconds from time push app, start and get past gamesalad screen into my intro scene.

    then when i'm on my draw scene it will take 13-20 seconds to pick a card.
    i reset my phone seemed to help a tiny bit.. phone has been running a little sluggish lately.
    i'd give out promo codes if i could get the thing on the app store :)
    trying to find out where you request a contract for where you can charge and put banking info into.. i only have 1 contract displayed it's only for free apps.
    and thx tshirt.
Sign In or Register to comment.