Post by Ashley Hall on May 27, 2005 17:06:34 GMT 10
Ok, this ones a bit more involved than the other tutorials, but it works well afterwards.
first, make a movieclip of a car (nothing fancy just a rectangle).
Click on that and go to properties, give it the instance name "car" (without the quotes).
now go to the actions for the "car" and copy and paste this in there.
Now make a new movie Clip, a person (I just drew a circle) and give it the instance name "man" (again without the quotes)
Copy and paste this code into him
Now you've probably all tested the movie, and your wondering, "why isnt it working?"
DON'T PANIC!
You need to put a few text boxes in the movie.
DONT just get the text tool and put a few in then say "WAT THE FUCK?!?! IT STILL DOESNT WORK!!!"
okay, get the text tool (a little "A" on the tools")
Make two textboxes, make sure they're off the stage (the white square you do stuff on)
Make sure they're dynamic textboxes (in the properties bit) and give them the instance name and var name of
"incar"
"direct"
Okay, just to summarize that. U should have a car, a person and two textboxes on the stage now. The textbox's names should be incar and direct.
Ur done! it should work perfectly fine now, if not then add me 2 msn ash_man_04@hotmail.com
first, make a movieclip of a car (nothing fancy just a rectangle).
Click on that and go to properties, give it the instance name "car" (without the quotes).
now go to the actions for the "car" and copy and paste this in there.
onClipEvent (enterFrame) {
if (Key.isDown(90)) {
if (_root.incar == true) {
_root.incar = false;
_root.man._x = this._x-150;
_root.man._visible = true;
}
}
}
onClipEvent (enterFrame) {
if (_root.incar == true) {
if (Key.isDown(Key.LEFT)) {
this._x -= 10;
this._rotation = 270;
}
if (Key.isDown(Key.RIGHT)) {
this._x += 10;
this._rotation = 90;
}
if (Key.isDown(Key.UP)) {
this._y -= 10;
this._rotation = 0;
}
if (Key.isDown(Key.DOWN)) {
this._y += 10;
this._rotation = 180;
}
if (Key.isDown(Key.DOWN) && Key.isDown(Key.LEFT)) {
this._rotation = 225;
}
if (Key.isDown(Key.UP) && Key.isDown(Key.LEFT)) {
this._rotation = 315;
}
if (Key.isDown(Key.UP) && Key.isDown(Key.RIGHT)) {
this._rotation = 45;
}
if (Key.isDown(Key.DOWN) && Key.isDown(Key.RIGHT)) {
this._rotation = 135;
}
}
}
Now make a new movie Clip, a person (I just drew a circle) and give it the instance name "man" (again without the quotes)
Copy and paste this code into him
onClipEvent (load) {
_root.incar = false;
}
onClipEvent (enterFrame) {
if (_root.incar == false) {
_root.direct = this._rotation;
if (this.hitTest(_root.car)) {
_root.incar = true;
this._x = _root.car._x;
this._y = _root.car._y;
}
this._visible = true;
if (Key.isDown(Key.LEFT)) {
this._rotation = -90;
this._x -= 5;
}
if (Key.isDown(Key.RIGHT)) {
this._rotation = 90;
this._x += 5;
}
if (Key.isDown(Key.UP)) {
this._rotation = 0;
this._y -= 5;
}
if (Key.isDown(Key.DOWN)) {
this._rotation = 180;
this._y += 5;
}
if (Key.isDown(Key.SPACE)) {
duplicateMovieClip(_root.bullet, random(423145), random(4234543));
}
if (Key.isDown(Key.UP) && Key.isDown(Key.LEFT)){
this._rotation = -45;
}
if (Key.isDown(Key.DOWN) && Key.isDown(Key.LEFT)){
this._rotation = -135;
}
if (Key.isDown(Key.DOWN) && Key.isDown(Key.RIGHT)){
this._rotation = 135;
}
if (Key.isDown(Key.UP) && Key.isDown(Key.RIGHT)){
this._rotation = 45;
}
} else {
this._visible = false;
}
}
Now you've probably all tested the movie, and your wondering, "why isnt it working?"
DON'T PANIC!
You need to put a few text boxes in the movie.
DONT just get the text tool and put a few in then say "WAT THE FUCK?!?! IT STILL DOESNT WORK!!!"
okay, get the text tool (a little "A" on the tools")
Make two textboxes, make sure they're off the stage (the white square you do stuff on)
Make sure they're dynamic textboxes (in the properties bit) and give them the instance name and var name of
"incar"
"direct"
Okay, just to summarize that. U should have a car, a person and two textboxes on the stage now. The textbox's names should be incar and direct.
Ur done! it should work perfectly fine now, if not then add me 2 msn ash_man_04@hotmail.com