What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
I need help in my “project I’ve just started” using AS2.
I’m trying to make a “minigame” where clickable markers generates within an area
and the player just needs to click it before it goes away to score, It’s like OSU!Though it doesn’t involve music and rythme.
My problem is: Markers are spawning all over the place “when what i just want to happen is to spawn them within the shaded area/movieclip, like I’m giving them a boundary”. I can’t proceed with other stuffs for this game due to this being the most important part of it.
I think all I have to do is modify these lines, but I don’t know the right thing to input/change:
//field is the shaded box movieclip for containing spawned markers, giving them bounds.
_root.field["en"+runningtime]._x = int(Math.random()*field._height);
_root.field["en"+runningtime]._y = int(Math.random()*field._width);
Thanks in advance for any help.
field is the shaded area where you want the things to spawn.
thing is the thing you want to spawn.
The + field.x is only if the field isn’t at (0,0)
`thing.x = field.x + (Math.random()*field.width)
thing.y = field.y + (Math.random()*field.height)`
**EDIT: I found that you mixed up width and height. Swap them around.**
You could spawn the marker, and then check if it is within the specified area. If it is, you leave it as it is, if it is not, reposition it and check again. (Use a while loop for this). This especially useful if the boundary is not a rectangle.