Jump to content


Random Positioning Problem


  • You cannot reply to this topic
3 replies to this topic

#1 Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 17 October 2006 - 02:37 AM

Ok, same game as before, but I have a new problem:

I want the balls that get attached to be in random positions, but I want them to be set outside the stage. I still want them coming from all directions though. So, basically, I want them to be in random positions around the edge of the stage. Heres a picture of how I need it:
Posted Image

Its hurting my brain, so if anyone could help, that would be great.

#2 Kai Fluegel

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 17 October 2006 - 04:42 PM

I'm not really good with Flash but I used a random code on one of my pieces of work, I got it from a learn flash tutorial but it is on a rollover, i'm not sure if you can apply it to your problem.

on (rollOver) {
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;
return randomNum;
}
_x = randRange(10,440);
_y = randRange(10,80);
}

#3 Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 17 October 2006 - 04:48 PM

Thanks, that should work fine. I'll test it when I get back home.

#4 Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 18 October 2006 - 01:08 AM

Didnt read it right. Sorry that doesnt help, it only randomises it inside a square, not around it. Thanks for helping though.

EDIT: Nevermind, I figured it out ;)

Edited by d4rkst0n3, 18 October 2006 - 01:21 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users