~ he he, squiggly
Oh yes, my tutorial!
NOTE: any AS that has these colors withh correspond to the explanation next to it.
green: changeable
normal: just plain AS
orange: instance name. can be changed
Ok, here we go!
1. draw you character.
2. make him a movie clip (F8 )
3. give him the instance "guy" (without the quotation marks)
NOTE: Instance names can be changed, just make sure everythin in the AS that says guy is changed to what ever you put as the instance name, such as "hero."
4. Insert this code:
- Code:
-
onClipEvent (load) {
speed = [color=green]10[/color]
}
OnClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_his._x -= speed
}
if (Key.isDown(Key.RIGHT)) {
this._x += speed
}
if (Key.isDown(Key.UP)) {
this._y -= speed
}
if (Key.isDown(Key.DOWN)) {
this._y += speed
}
}
// end of code
ok, now to make items to gain you points.
1. draw whatever you want to gain you points
2. make it a movie clip (F8 )
3. double click on the movie clip to go inside it.
4. right-click on frame to and select "insert blank keyframe"
5. click on frame 1 and press F9 fro action script
6. insert this on frame 1 and 2:
- Code:
-
stop();
7. go back to scene 1 and click on Frame 1
8. insert this on fame 1 action script:
- Code:
-
[color=green]score [/color]= 0
NOW do this.
9. make a text box and set it to dynamic.
10. give it the instace "
score" minus the quotation marks. and in the box next to var put this: "_root.
score" minus quotation marks
if you test it, the score dynamic txt box should say "0" minus the quotation marks.
now to make it desapear when you touch it, and make it gain you points.
ok, now put this script on the itemthatgivesyoupoints movie clip:
- Code:
-
onClipEvent (enterFrame) {
if (this.hitTest(_root.[color=green]guy[/color])) {
_root.score += [color=green]10[/color]
this.gotoAndPlay (2);
}
}
if you did this right, you should be able to walk around, collect the item, and gain points.
I will continue this later, this just makes the guy move around, and make him gain points.
if there is any problems, post below.