-
Games in KoolMoves?
Is it possible to make simple games in KoolMoves. Heres basicly whay
im treing to do. I want the character to go to the left when the left arrow key pressed and to the right when the right arrow key was pressed. If you guys have any tutorials or snippets of code would be helpfull. thanks in Advanced.
:D
-
There is a lot of code and snippets already posted and I have personally written 3 or 4 games with KoolMoves and helped another 2 or 3 people write their own. Necromanthus has also written quite a few games and there are several samples on his website.
Anyhow...
To make an object move with AS you have to access its _x and _y properties. You can only move loaded movies and Movie Clips. To do this you reference it as pathname.objectname._x = some value. _x is the horizontal position where as _y is the vert position. The values start at _y=0 as the top of the screen and _x=0 as the far lefthand corner.
To derive your pathname you start at _root and every clip and loaded movie off of the main timeline can be accessed. So if I have a movieclip named bob on my maintimeline I refrence it as _root.bob. You cold just access it from the main timline as bob. or this.bob if you have a AS placed on a frame on the main timeline. If you have a MC called Bob and it has a MC called fred you access it this way _root.bob.fred if you are on the main timeline. If you are placing the script inside of bob its this.fred . Now if your clip is farther down the timeline z index then bob is accesed from fred as either _root.bob or _parent.bob. You can also access levels EG; root.level1.play() will play a the movie loaded into level 1.
You can also use the startDrag() and stopDrag() functions if you just want to have something follow the mouse.
In order to find out if a key was pressed you use Key method. An example of this is like this if(key.isDown(key.DOWN){
pathname.movieclip._y -=1;
}
The above script will move your named clip (You must replace path and movieclip) 1 fip down if you press the down key.
The other keys are simular. Its key.UP, key.LEFT, and key.RIGHT .