# Shooting game - birds eye view

**URL:** <https://forum.kirupa.com/t/shooting-game-birds-eye-view/162814>\
**Category:** programming\
**Created:** [September 16, 2005, 1:59pm UTC](https://forum.kirupa.com/t/shooting-game-birds-eye-view/162814 "2005-09-16T13:59:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_Pancake](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Mr\_Pancake](https://forum.kirupa.com/u/Mr_Pancake)\
**Post date:** [September 16, 2005, 1:59pm UTC](https://forum.kirupa.com/t/shooting-game-birds-eye-view/162814/1 "2005-09-16T13:59:25Z")

</div>

[size=3]Hi,[/size]  
[size=3][/size]  
[size=3][/size]  
[size=3]I’m making a birds eye view - shooter.[/size]  
[size=3][/size]  
[size=3]and i can’t make him shooting…[/size]  
[size=3][/size]  
[size=3]here is the action script for the man:[/size]  
[size=3][/size]  
[size=3]

> onClipEvent (load) {  
> // declare and set speed variable  
> speed = 5;  
> }  
> onClipEvent (enterFrame) {  
> // move up, down, left, or right  
> if (Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT)) {  
> \_x -= speed;  
> \_rotation = 270;  
> \_root.Mc;  
> gotoAndPlay(2);  
> }  
> if (Key.isDown(Key.RIGHT) && !Key.isDown(Key.LEFT)) {  
> \_x += speed;  
> \_rotation = 90;  
> \_root.Mc;  
> gotoAndPlay(2);  
> }  
> if (Key.isDown(Key.UP) && !Key.isDown(Key.DOWN)) {  
> \_y -= speed;  
> \_rotation = 0;  
> \_root.Mc;  
> gotoAndPlay(2);  
> }  
> if (Key.isDown(Key.DOWN) && !Key.isDown(Key.UP)) {  
> \_y += speed;  
> \_rotation = 180;  
> \_root.Mc;  
> gotoAndPlay(2);  
> }  
> //  
> // move diagonally  
> if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP) && !Key.isDown(Key.RIGHT) && !Key.isDown(Key.DOWN)) {  
> \_rotation = 315;  
> \_root.Mc;  
> gotoAndPlay(2);  
> }  
> if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP) && !Key.isDown(Key.LEFT) && !Key.isDown(Key.DOWN)) {  
> \_rotation = 45;  
> \_root.Mc;  
> gotoAndPlay(2);  
> }  
> if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN) && !Key.isDown(Key.RIGHT) && !Key.isDown(Key.UP)) {  
> \_rotation = 225;  
> \_root.Mc;  
> gotoAndPlay(2);  
> }  
> if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN) && !Key.isDown(Key.LEFT) && !Key.isDown(Key.UP)) {  
> \_rotation = 135;  
> \_root.Mc;  
> gotoAndPlay(2);  
> }  
> }  
> onClipEvent (enterFrame) {  
> if (Key.isDown(Key.SHIFT)) {  
> duplicateMovieClip(\_root.bullet, “bullet” + i, i)  
> i++;  
> }  
> }

[/size]  
[size=3][/size]  
[size=3]he can walk in 8 directions whilst looking at the direction.[/size]  
[size=3][/size]  
[size=3]now for the bullet code: [/size]  
[size=3][/size]  
[size=3]

> onClipEvent (load) {  
> rotation = \_root.man.\_rotation;  
> this.\_rotation = rotation;  
> speed = 20;  
> if (this != \_level0.bullet) {  
> this.\_x = \_root.man.\_x;  
> this.\_y = \_root.man.\_y;  
> }  
> }  
> onClipEvent (enterFrame) {  
> if (this != \_level0.bullet) {  
> this.\_x += Math.sin(rotation \* (Math.PI/180)) \* speed;  
> this.\_y += Math.cos(rotation \* (Math.PI/180)) \*- speed;  
> }  
> }  
> [/size]  
> [size=3][/size]  
> [size=3]can someone fix this problem ? if u don’t understand check the [/size]  
> [size=3]attachment ;)[/size]

[size=1]©to the man who posted this once on the forum

[/size]
