how do i send a actor to a specific random position?

guillefaceguilleface Member Posts: 1,014
edited November -1 in Working with GS (Mac)
i know how to use random(x,y) but it sends my actor to areas i don't want,
i want to send it between this points. to random when actor is offscreen or destroyed
x=25,y=480
x=50,y=480
x=75,y=480
x=100,y=480
to cover all the way to 280 width, pretty much 8 points. any help will be great

Comments

  • guillefaceguilleface Member Posts: 1,014
    i try that but it can go to x= 26,27,28 etc, i don't need those x position , only to 25,50,75 ,,,,
  • LiquidGameworksLiquidGameworks Anchorage, AKMember, Sous Chef Posts: 956
    Create a probability attribute (integer). Have it change rand(0,100) every .3 secs (or whatever you need).

    Then on your moving actor, say "if game.att.prob < 25, go to x=25". If "25<game.att.prob<50, go to x=50", and so forth. This creates probability distributions that allow you to specify a very specific percent chance that an event happens. You'll have to play with the % to make sure there is even probability (for 8 points probably moving by 12ish).

    Hope that helps.

    I'm too slow!
  • guillefaceguilleface Member Posts: 1,014
    thanks a lot this sound perfect i will try this right now, thank you
  • guillefaceguilleface Member Posts: 1,014
    ok so i ran into troubles, first i make sure i set the rules right but for some reason sometimes my actor just don't comeback to those position, for example i set when self position y is less than or equal 28 change attribute random position to random(1,5) so it does go to those position but sometimes when is moving down and reach again the y 28 position nothing happen, and also so i drag another actor on the screen but when one actor ready 28 the other actor also disappear, i try to create a self position but can't manage to work
  • guillefaceguilleface Member Posts: 1,014
    thats the one i am using,
    when radomposition=1
    to to x=14,y=480
    when radomposition=2
    go to x=42, y=480
    when radomposition=3
    go to x-70,y=480
    when randomposition=4
    go to x=98,y=480
    when randomposition=5
    go to x=126, y=480

    and to trigger this i changed to , when actor collides with wall change "randomposition" to random1,5)
    so when i click play it can do this like 8 times and when actor is again coming down and hits the wall it just stay there. why is not again going back to one of those position? so i click rester and this time it only works like 3 times and gets stuck
  • guillefaceguilleface Member Posts: 1,014
    i also add a second rule, when actor motion velocity y is =0 to change randompositio to random(1,5) so in the actor i have to display motion velocity y, so when the actor stop i can see the 0 but i just won't go back and also when actor when collide with my main actor i have to change position too, most of the time it does go back but sometimes the actor don't detect the overlapping and it just pass through which looks ugly
  • guillefaceguilleface Member Posts: 1,014
    thanks i still have problems but i should be able to do it with that file, just one think , on the file how is the thing moving, like where is the rule that sets the velocity, i looked everywhere and i can't figure out how tshirtboot set that rule, is driving crazy now to know that lol,
  • guillefaceguilleface Member Posts: 1,014
    lol ok go it, just one thing men , i create a new project from 0 no rules nothing , but this is on portrait, so i set each rule exactly like yours, but when still sometimes , well a lot of times my actor1 won't overlap with actor2 so it just pass throughout, i have no idea what aim doing wrong.
  • guillefaceguilleface Member Posts: 1,014
    ok so i made a video since this you project keeps working fine lol
  • gmedina.172gmedina.172 Member Posts: 94
    Hey I have a problem trying to spawn specific random actors like making a group of actors and spawn them randomly, The thing is that i tried an attribute and I didnt know how it worked, also I want to spawn this group of actors randomly at a random time, but another problem is that when i put a random time using a timer with "every" it justs randomly choose a number and stick to it, and what I want is from that range choose a random time every time it spawns can you help me out??
Sign In or Register to comment.