Random using

jehd1914jehd1914 Member Posts: 21
edited November -1 in Working with GS (Mac)
how do you use the term random in spawning?

Comments

  • VoidedSkyVoidedSky Member Posts: 1,095
    ----Rule; when touch is pressed: change attribute self.random_Number to random(1,5)

    ----Rule; when self.random_Number = 1
    ------Spawn actor XXX

    ----Rule; when self.random_Number = 2
    ------Spawn actor XXY

    ----Rule; when self.random_Number = 3
    ------Spawn actor XYY

    ----Rule; when self.random_Number = 4
    ------Spawn actor YYY

    ----Rule; when self.random_Number = 5
    ------Spawn actor XYX

    Hope this helps!!
    ~CTM
  • jehd1914jehd1914 Member Posts: 21
    what attribute is it?
  • WeswogWeswog Member Posts: 1,171
    Integer Attribute

    Cheers, Weswog
  • VoidedSkyVoidedSky Member Posts: 1,095
    Weswog said:
    Integer Attribute

    Cheers, Weswog

    Thanks for picking up my slack weswog;-)
  • jehd1914jehd1914 Member Posts: 21
    So what should the attributes be?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    @jehd1914: To make CowTechMan's code work, you will need to create an integer attribute called 'random_Number' in the Actor.

    If you are unsure about creating Attributes and Rules, you should spend some time reading all the articles in the support section up above.

    http://gamesalad.com/wiki/

    That will give you a more solid footing and help you get up to speed using GameSalad.
  • jehd1914jehd1914 Member Posts: 21
    Thanks! Also, I'm sorry to ask so many questions, but what should the position be for the actors to spawn at the top so they are not visible at first, and come down?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi jehd1914, if you want your spawned actor to be out of screen when its spawned, you need to make sure that its y position is more than the depth of your window. So presuming you're window size is portrait, 320 x 480, then x can be something like 100, and y, something like 520. Hope that helps.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.