1. How do you make that sort of bullet when you fire? I know how to attach a bullet and make it follow a certain path depending on your gun's rotation, etc. But what they did was create a white line that's the bullet and can detect whether or not it hits something. How can I achieve this?
What I would have done is attached a bullet movieclip, but not a regular bullet, this one would store the start position,x,y and then every frame would increase it's own x,y by its dir, and drawing a line using flash drawing API from the start x,y to this._x , this._y.
http://www.flash-creations.com/notes/dyn amic_drawingapi.php
It would use a hitTest, probably not using flags as the ground you can see was probably just part of the background in some way (as a seperate MC or otherwise) and there's an invisible box that bullets and units are hittested on.
So the code for the bullet might go a little like this:
//Shoot code
//...OnEnterFrame stuff, check if the mouse has been
//clicked with a bool set by mousePressed, mouseReleased functions
bullet = _root.attachMovie("bullet","bullet"+_root.getNextHighestDepth(),_root.getNextHighestDepth();
bullet._x = ((this.gun._x+this.gun._width)*this.dir)+this._x;
bullet._y = ((this.gun._y+this.gun._height/2)+this._y;
bullet.speed = 15;
bullet.dir = Math.atan2(_ymouse-_(this.gun._y+this.gun._height/2),xmouse-((this.gun._x+this.gun._width)*this.dir));
//Doesn't fit on one line, fix that in flash
startx = this._x;
starty = this._y;
//Vars only start once, and should be called well after you set its X and Y earlier, so shouldn't be 0.
this.onEnterFrame = function()
{
this._x += Math.cos(this.dir)*this.speed;
this._y += Math.sin(this.dir)*this.speed;
this.clear();
this.lineStyle(3, 0xFFFFFF, 100);
this.lineTo(startx, starty);
if(_root.ground.hitTest(this._x,this._y,false)
{
//So should create a dirt kickup that removes itself when the animation finishes
// using the line this.removeMovieClip(); on the very last frame of the animation
mc = _root.attachMovie("dirtkickup","dk"+_root.getNextHighestDepth(),_root.getNextHighestDepth());
mc._x = this._x;
mc._y = this._y;
mc._rotation = this.dir*180/Math.PI;
this.removeMovieClip(); //This bullet is done for.
}
}
2. How can I rotate the character's arm smoothly like that? My mouse rotation script follows the mouse exatctly, there character's arm kind of "smoothly" rotates/follows the mouse around the screen. How can I achieve this?
My guess is just a larger framerate than what you may be using, if you are using something like 24-30, then I have no idea. But if you are using something like 12 (the default) then that might be why.
All animators i've worked with or currently am working with, have requested either 24 or 30 FPS for the game.
3. When you move your mouse around the screen, the V-cam follows it, but still keeps it on the player's general position. How can I achieve this?
I guess it just takes the distance from the mouse x and y to the player x and y, and figures out how much to move it based on that. Maybe somethin like
//onEnterFrame stuff..
_root.camera._x = (_root._xmouse - _root.player._x)+_root.player._x;
_root.camera._y = (_root._ymouse - _root.player._y)+_root.player._y;
That's all I've got to say, dinner's ready, good luck