velocity attribute + random spawn around screen
mr_potato
Member Posts: 22
Hey there, straight to it. say i have actor a and an actor b i have actor b constrained to the very middle of the scene editor and i want actor a to come in from a random spot outside of the scene editor moving at a constant rate towards actor b.
even further. i want there to be an unlimited amount of actor a's coming from random places from outside of the scene editor at random times. all moving towards actor b. Can anyone help me with this?
Comments
Hi @mr_potato and welcome to the GameSalad Forums.
The following is untested but should work (and it's also assuming your actor a doesn't move - although I'm guessing it might rotate):
P.S The rules I've shown here are for the Mac version of GSC using that terminology -so need a little bit of "translation" for your PC version ("Do", etc....)
Make two game integer attributes, let' call them Ax and Ay. Make their values the x and y coords. of actor A.
Make another integer attribute, call it SideRand
Make yet another integer and call it TimeEvery -set its initial value to the delay of each
spawned actor B, i.e if you want them spawning every 5 seconds, make its value 5 --
Two more integer attributes, called BBX and BBY
Make a final integer Attribute, called BActAngle
Put the following in a blank actor somewhere outside of the screen area.
Now in the rules of Prototype of ActorB, in the Inspector, put:
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Hey thanks for this will try now
hey. @Gyroscope in the rules of actor prototype b when you say 'otherwise' is that a new rule or is it just another 'change attribute' behaviour?
also what is ' change attribute bbx to ??' and ' change attribute bby to ??'
and at the bottom i cant seem to find scene. angle
Hi, I don't use the Windows GSC version so can't remember to tell you what "Otherwise" is called on your version.... it's whatever the equivalent of "Otherwise" is as part of the same rule (Do).... hope I've explained myself clearly enough...
(Perhaps some one else could chime in here to remind me of the "Otherwise" PC GSC version word...
• The question marks are because the numbers will be different depending on what size screen you are using... I did give an explanation in the programming suggestion, but I'll explain again...
So you work out the following numbers: the width of your screen + at least half the width of your actorb, that'll be the number for " Change Attribute BBX to ??"
Similar for "Change Attribute BBY to ??" the ?? you replace with a number which is the height of your screen + at least half the height of your actor
Both of those two are to ensure your spawned actor b appears outside of the screen at the top or at the right hand side. (For the left and bottom sides, I simply guises the number -60 in both cases, i.e assuming your actor b isn't anymore wider than 120 pxls)
• As for the attribute Angle, I suggested you make that as an integer at the beginning of the explanation.
Hope that sorts it for you....
Edit: I did think at the time I shouldn't be making the name of an integer attribute the same as another type of attribute (i.e an angle type attribute) as I thought it might cause confusion (which it did!)... but I went ahead anyway....
For clarity sake then, let's change the name of the integer attribute I called Angle, to BActAngle. I'll amend the above rules accordingly for you so it's clearer.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
just re- read the start of your initial comment and my actor a is the one that is moving towards actor b, and actor b is stationary. but i want there to be an unlimited amount of actor a's to be spawning from outside the screen at random positions at random times heading towards actor b
@gyroscope
Here's another way of doing it . . .
Link: https://www.mediafire.com/?2ac3w5kso27c77w
Oh, yes, sorry, got them around the wrong way round! Here it is again with easy amendments:
Make two game integer attributes, let' call them Bx and By. Make their values the x and y coords. of actor B.
Make another integer attribute, call it SideRand
Make yet another integer and call it TimeEvery -set its initial value to the delay of each
spawned actor A, i.e if you want them spawning every 5 seconds, make its value 5 --
Two more integer attributes, called ABX and ABY
Make a final integer Attribute, called AAng
Put the following in a blank actor somewhere outside of the screen area.
Now in the rules of Prototype of ActorA, in the Inspector, put:
Or use @Socks' method...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
OMG @socks thankyou so much. plus @gyroscope thankyou you so much for your help but because im new here some of your wording didnt get through to me thankyou both so much
You're welcome; and glad it will help you; best of luck with all your future game-making endeavours.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Hi there @socks, i have been working on my project that used the link that you sent. Now i am partially finished. but what i want to know is if it can only be used on an ipad or multiple apple devices. If it is only compatible for an ipad how can i change it to iphone so i can reach a larger customer audience, I have previously tried to add everything ( attributes, rules etc) into an iphone template but i have had no success.