Pages: 1
Topic closed
I have a question, I'm making a "hit'em up", it pops out from a "hole" and then you have to hit it, so my problem is making the object pop out in certain coordinates or in the center of the "holes" in a random way. thanks in advance!
Offline
Create a list with the hole coordinates, then do somthing like this:
when gf clicked forever wait [(pick random 1-4) seconds] set x to[(item (pick random 1-7) of [Hole coordinates X pos v] set y to[(item (pick random 1-7) of [Hole coordinates Y pos v]You need to create two lists: One holding the "y" pos. of the hole, and one holding the ""x" pos.
Last edited by mythbusteranimator (2012-05-11 10:37:35)
Offline
mythbusteranimator wrote:
Create a list with the hole coordinates, then do somthing like this:
when gf clicked forever wait (pick random (1) to (4) ) secs set x to (item (pick random (1) to (7) ) of [holecoordinatesXpos v]) set y to (item (pick random (1) to (7) ) of [holecoordinatesYpos v])You need to create two lists: One holding the "y" pos. of the hole, and one holding the ""x" pos.
Fixed.
Offline
trinary wrote:
mythbusteranimator wrote:
Create a list with the hole coordinates, then do somthing like this:
when gf clicked forever wait (pick random (1) to (4) ) secs set x to (item (pick random (1) to (7) ) of [holecoordinatesXpos v]) set y to (item (pick random (1) to (7) ) of [holecoordinatesYpos v])You need to create two lists: One holding the "y" pos. of the hole, and one holding the ""x" pos.Fixed.
You can actually just use the
set x to (item (any v) of [holecoordinatesXpos v])block.
Offline
amcerbu wrote:
trinary wrote:
mythbusteranimator wrote:
Create a list with the hole coordinates, then do somthing like this:
when gf clicked forever wait (pick random (1) to (4) ) secs set x to (item (any v) of [holecoordinatesXpos v]) set y to (item (any v) of [holecoordinatesYpos v])You need to create two lists: One holding the "y" pos. of the hole, and one holding the ""x" pos.Fixed.
You can actually just use the
set x to (item (any v) of [holecoordinatesXpos v])block.
Great point amcerbu, I changed the script. It's more efficient now.
Last edited by jontmy00 (2012-05-11 23:49:46)
Offline
d
jontmy00 wrote:
amcerbu wrote:
You can actually just use the
set x to (item (any v) of [holecoordinatesXpos v])block.Great point amcerbu, I changed the script. It's more efficient now.
Only if the holes are on a grid-like system. Otherwise, the x and y coordinates won't match up (e.g. go to x: (item 1 of list x) y:(item 4 of list y) )
Offline
MoreGamesNow wrote:
d
jontmy00 wrote:
amcerbu wrote:
You can actually just use the
set x to (item (any v) of [holecoordinatesXpos v])block.Great point amcerbu, I changed the script. It's more efficient now.
Only if the holes are on a grid-like system. Otherwise, the x and y coordinates won't match up (e.g. go to x: (item 1 of list x) y:(item 4 of list y) )
Hmm...I just realized that.
Maybe create avariable called "List item1" and set "list item 1" to the item number of the 'holecoordinatesxpos', and then choose item "listitem1" of 'holecoordinatesxpos'?
Offline
As in,
set x to [(item [any v] of [holex v])] set [list item v] to item [(x position)] of [holex v] set y to [(item [(list item) of [holey v])]Hm... that might not work.
Offline
Also, you might want to number the holes, and use the following script, so that 2 don't appear in 1 spot.
set [xnum v] to <pick random (1) to (7)> set [ynum v] to <pick random (1) to (4)> if <not <[used v] contains <<(ynum)-[1]>*[7]>+(xnum)>> go to x: <item (xnum) of [x's v]> y: <item (ynum) of [y's v]> add <(ynum)-[1]>*[7]>+(xnum)> to [used v]
Last edited by parcheesidude (2012-05-12 12:28:57)
Offline
This should do it:
set [listIndex v] to (pick random (1) to (7)) set [desiredXPosition v] to (item (listIndex) of [XPositions v]) set [desiredYPosition v] to (item (listIndex) of [YPositions v])
Last edited by amcerbu (2012-05-12 11:25:29)
Offline
amcerbu wrote:
This should do it:
set [listIndex v] to (pick random (1) to (7)) set [desiredXPosition v] to (item (listIndex) of [XPositions v]) set [desiredYPosition v] to (item (listIndex) of [YPositions v])
Even better. Everyone seems to be trying to be coming up with a better script.
Offline
jontmy00 wrote:
amcerbu wrote:
This should do it:
set [listIndex v] to (pick random (1) to (7)) set [desiredXPosition v] to (item (listIndex) of [XPositions v]) set [desiredYPosition v] to (item (listIndex) of [YPositions v])Even better. Everyone seems to be trying to be coming up with a better script.
That works (it was right in front of me the whole time, :p)
Offline
mythbusteranimator wrote:
Create a list with the hole's coordinates, then do somthing like this:
when gf clicked forever wait (pick random (1)to (4)) secs set x to[(item (pick random 1-7) of [Hole coordinates X pos v] set y to[(item (pick random 1-7) of [Hole coordinates Y pos v]You need to create two lists: One holding the "y" pos. of the hole, and one holding the ""x" pos.
Fixed.
Last edited by laser314 (2012-05-14 14:18:22)
Offline
Topic closed
Pages: 1