How to move enemy randomly and random size

JaxterJaxter Member, PRO Posts: 398
edited November -1 in Working with GS (Mac)
1. MY enemy's are coming from right to left.. but i want to add function of them to move little bit about 20 pix to up and down at the same time to make game harder..

2. How to make random size of enemy's ?

Comments

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    1. Like in a wave motion? There is a How To on that. http://gamesalad.com/wiki/how_tos:gsc_wave_movement#sine_movement

    2. use the random function in the expression editor and then do a Change Attribute on the width and height of the actor.
    Change Attribute: self.randomSizeFactor = random(5,10)
    Change Attribute: self.Size.Width = self.Size.Width*self.randomSizeFactor/10
    Change Attribute: self.Size.Height = self.Size.Height*self.randomSizeFactor/10
  • JaxterJaxter Member, PRO Posts: 398
    i can not find "SizeFactor" after size is just with and height no factor in list..
  • sdparduesdpardue Member Posts: 110
    randomSizeFactor is an Attribute you define for the Actor.
  • JaxterJaxter Member, PRO Posts: 398
    but it is not in list..
  • sdparduesdpardue Member Posts: 110
    After you create the Attribute for your Actor, you'll find it in the Expression Editor at the "top level" of the Actor Attributes, usually just below Tags and above Motion and Physics. (not in the Size group)
  • CobraCobra Member Posts: 160
    To clarify: You can create your own attributes, like "OnFire" or "HasCheezburger" or "randomSizeFactor," for any of your actors. Just click the "+" button below the actor's attribute list.

    Once you've created an attribute to hold your random size factor, then you can create the rules that Codemonkey suggested.
  • JaxterJaxter Member, PRO Posts: 398
    Tnx Cobra i know it , but what type that "sizefacor" must be when i creating it in atributes? ( boolean , real or what? ) and what i must type in options there?
  • CobraCobra Member Posts: 160
    "Real" and "integer" both hold numbers; real allows for decimals. Either should work for this purpose.

    "Boolean" is used like a switch: it is either true (1) or false (0).

    Is that what you needed to know? :D
  • JaxterJaxter Member, PRO Posts: 398
Sign In or Register to comment.