ActionScript 2.0 :: Making An Arrow/bullet Move Where The Mouse Was?
Oct 13, 2008
i want to make a game where u shoot arrows at the mouse direction, i have everything exept for that, i think is trigonometry, i have seen it on many games but i cant seem to figure it
im planning to make the arrow something like this
onClipEvent(enterFrame)
{
if(Key.isDown(Key.SPACE) && _root.readytoshoot == 1)
{
[Code]....
View 4 Replies
Similar Posts:
Jan 27, 2011
i'm attempting to make a platform game, i know how to move left and right with the arrow keys, but that's quite boring. i want to move my character based only on the x movement of my mouse. the more i move my mouse in a certain direction, the faster the character moves in that direction. i've been trying to modify the x-speed on my character based on a x value of the mouse, but nothing is working.
preferably, i want a code that keeps my cursor at the center of the screen, while still being able to detect x movements of the mouse. i'd copy paste code from my program, but i'm fairly confident that doing so will serve no purpose. i need a new direction. i have no idea how to do this.
View 9 Replies
Jun 5, 2009
I found some instruction here: [URL]. So, I don't want scrollbar or anything, I presume textfield must have focus, but I cant make it work....
View 1 Replies
Jul 1, 2009
How is an effect like this created? The effect is after you click "enter site", you see the background moves a bit when the viewer moves the mouse.[URL]
View 2 Replies
Dec 25, 2006
How would you go about making a movie clip shoot a bullet from it, but have the movieclip able to move around, like a sidescroller game...
View 2 Replies
May 28, 2009
I'm making a shooter. Whenever my bullet starts flying and I move my character the bullet keeps moving with it. The rotating gun is in the body movieclip layer so it follows the body around and I can move the gun is there anyway to disconnect the bullet from also moving around with the body ?
Code:
stage.frameRate = 30;
var angle:Number = 0;
var radiansToDegrees:Number = 180/Math.PI;
var degreesToRadians:Number = Math.PI/180;
var currentGeweer_mcRotation:Number;
var Bullet_mcHolder:MovieClip = new MovieClip();
addChild(Bullet_mcHolder);
[Code] .....
View 18 Replies
Mar 25, 2011
I'm currently making my own shoot'em up game where the player can switch between two player types which will fire their own bullet type in this case, squares and circles. I've setup the player switch function via pressing "space" button (switching between the two player types) and the default bullet type is "squares" and I'm not sure to approach the coding with changing the bullet type to "circles".I've written 2 classes for the bullet and player setup:Player Class: Creates instance of bullet on screen and enables the switch player type function
Bullet Class: Enables bullet properies and bullet types Player Class: Code:function onKeyDown(event:KeyboardEvent):void {if (event.keyCode == 32) //// pressing/holding "space bar" to function
[code]....
View 5 Replies
Nov 24, 2008
I'm trying to make my platform game character shoot a gun, my character and gun are one movieclip and the bullet is another. The bullet mc starts on a blank frame with a stop() function, when I press the space bar the bullet mc plays from frame 2 which is a motion tween of the bullet quickly moving across the page. I've set the bullet's y and x values relative to the character mc so that the bullet always comes from the gun.
My issue is that if I press the space bar a bullet will fly out of the gun (great!) but if I press the space bar again, the first bullet disappears and the bullet animation starts again. I want to be able to shoot a new bullet every time I press the space bar without effecting the bullets that have already been shot.
[Code]....
View 3 Replies
Mar 31, 2010
I have a file set up with a movie clip moving from side to side by itself and when it reaches the end of the stage it goes back in the opposite direction.[code]I know want to control the movie clips movement with arrow keys, just left and right so that it would stop when it reaches the edge and will only let me move it the opposite direction.I guess I'm just trying to set up a sort of template.
View 9 Replies
Oct 4, 2009
i have 2 classes, one for ship one for bullet.i was trying to set the bullet.x to ship.x in the bullet class but it keeps telling me undefined. but clearly it is in my ship class.
View 10 Replies
Jul 30, 2009
I need to make a bullet launch at different degrees (anywhere from 1-360) from a specific point towards the mouse.
View 3 Replies
Jun 24, 2010
so first off, this is AS 2.0. Second, i have a little character from a tutorial on how to move an object around with the arrow keys. The character faces on way on "up" another on "down" and so forth. There are 4 frames for it facing up, down, left, and right so that on the key presses it faces the proper direction and moves accordingly. I also want this little guy to move behind objects. When this happens, i want the object that the little guy is behind to be partially transparent so that you can still see him and he doesnt just vanish.
[Code]...
View 3 Replies
Nov 9, 2010
Ok basically what is happening is that i play my game and when i die i goto the game over screen. once i click the play again button it goes back to the beginning but there's a problem. the arrow keys will not move the character left or right.So a few ideas is that the
Code:
onclipevent(load)
is not resetting the variables on the next play. Another is that the
[code].....
View 1 Replies
May 21, 2010
in this image orange arrow i want to move left-right. and up-down
View 5 Replies
Oct 18, 2011
In Fash CS3, suddenly, in certain files, I can't move an object left using arrow keys - but I can move the same object right, or if I hold down Shift + left arrow, it works correctly Also - I can move the object down with arrow keys, but not up Workaround - move an object on a different layer, then return to the problem object and it moves correctly. But this doesn't last long, the problem resurfaces.(I've tried rebooting; tried copying all the layers into a new file.
View 1 Replies
Feb 5, 2005
i want a my_mc to move when i press the < LEFT> arrow but also to fire and onEnterFrame event so it will move.. and also to delete the onEnterFrame when the key is not pressed so the onENterFrame is not going on in the background
View 4 Replies
Jun 8, 2010
My character's name is character. When left and right are pressed it tells me what's being pressed when I run it - it says there's no errors with the code. My character doesn't do anything though! [code]...
View 5 Replies
Aug 19, 2009
I'm using the actionscript below to Move Object Using The Arrow Keys and it works fine but I want to modify it so that when I press the up key it goes to and play a movie clip. Basically it's a ball movie clip that responds to the arrow key but on the up key it plays a bouncing movieclip and everything remains aligned.
Here is the script-
var speed =5;
this.onEnterFrame =function(){
if(Key.isDown(Key.UP)) {
circle._y -= speed;
} if(Key.isDown(Key.DOWN)) {
circle._y += speed;
} if(Key.isDown(Key.LEFT)) {
circle._x -= speed;
} if(Key.isDown(Key.RIGHT)) {
circle._x += speed;
}};
View 13 Replies
Apr 16, 2011
I created an animated character as a movie clip and I want to be able to move it using the arrow keys. I created a new layer and have the character on that layer.
View 9 Replies
Jun 26, 2011
so at the moment i have this in my maze game...[URL] i want it so i can move the circle with my arrow keys, which i can do and then when it hits the walls it makes them go back to the losing screen however i have tried but i cant seem to get it to work. i know maze games are newby but i am new =]
View 2 Replies
Mar 12, 2007
Basically I wanna remove my mc "ball" when you press the left arrow key. I've tried stuff like
Code:
if (Key.isDown(Key.LEFT)){
ball._x -= 1;
}
Some reason gives me like, "needs clip events"
View 6 Replies
Nov 3, 2009
I'm trying to move a movie clip using the arrow keys. It's a very simple test animation. Basically I have a stick character with simple walking animation. It has 3 movement. 1 is a forward walk, 2 is a duck and 3 is a backwards walk. Now I can move the character but I cant keep the animation going. Is there something I'm missing??
[Code]...
View 4 Replies
Aug 7, 2010
This actionscript 2 for moving a movieclip on stage in actionscript 2 .I would like to know what is the syntax in actionscript 3 .
movieclip.onEnterFrame = function(){
if (Key.isDown(Key.LEFT)) {
this._x -= 5;
}
}
cheers im new to actionscript 3 but nknow i need to make the change now.
View 9 Replies
May 21, 2011
you know how in some flash game the camera always follow the main character, and you move the character with arrow keys?
View 1 Replies
Aug 25, 2009
Adobe Flash CS4 - making a circular arrow spin clockwise
View 6 Replies
May 5, 2010
I've got arrow buttons and a movie clip on my stage. I have an event listener for each arrow button for a MOUSE_OVER event that calls a handler function in my movie clip. The handler functions just call prevFrame(); or nextFrame(); What I want to happen is that the movie clip continues to play forward or backward as long as the mouse is over the appropriate arrow button.
Stage Code:
leftArrow.addEventListener(MouseEvent.MOUSE_OVER, imgBar.goLeft);
rightArrow.addEventListener(MouseEvent.MOUSE_OVER, imgBar.goRight);
Movie Clip Code:
function goRight(event:MouseEvent):void{
this.nextFrame();
}
[code]....
I'm not sure if MOUSE_OVER is the correct way to do this if I want the function to continue as the mouse even only happens once.
View 3 Replies
Aug 12, 2011
I am trying to setup a movie where the user can move objects with the arrow keys. I have several objects that can be moved. My problem is that they all move at the same time. How can I fix it so you can click on an object and only that one object moves?
View 4 Replies
Sep 16, 2011
how can i make an object move with arrow keys on my keyboard, i am using as3.so when i hit the left arrow, it moves to the left etc..
View 5 Replies
Jul 1, 2009
I want to move arrow image in textarea on mouse click and key up and down like text editors
View 1 Replies
Mar 23, 2010
To move the MC, using arrow keys I used the following and it worked:
var timer:Timer;
var direct:String;
initStage();
[Code].....
I tried to convert this to use my onstage buttons: up_btn, down_btn, left_btn, right_btn to move MC box but couldn't figure it out.
View 1 Replies