ActionScript 2.0 :: Make A MC Like Shoot A Gun / Something When You Press Spacebar?
Aug 13, 2004How do you make a MC like shoot a gun or something when you press the spacebar?
View 1 RepliesHow do you make a MC like shoot a gun or something when you press the spacebar?
View 1 RepliesI havent used flash in years and I wanted to make a game. Ive made a few before but i didnt ever finish them and now i dont have them anymore. I wanna make this game where you are this man that can move around. (i can remember how to do that) and you shoot these huge exploding cats. How do i make the person shoot when you press the spacebar?How do i make the barrel of the gun follow the mouse and the bullets shoot that way?
View 10 Repliesis it possible to make flash to Press Spacebar or Press Enter in keyboard?i am trying to make a if textbox.length >= 3 , it will Press Spacebaris it possible to make flash really Press Spacebar out just like in the keyboard?
View 2 RepliesIm making a rock band 2 drum style game and i've come across a problem. Whenever theres 2+ notes together, all i have to do is hold down the button ( in this case space ) and it hits both of them without any penalty (which i havnt come across yet). But what i would liek it to do is that when u come across these notes you have to release space then press it again or else the note wont hit. Here is the code i am currently using.
onClipEvent(enterFrame){if(_root.hitspace.hitTest(this)&&(Key.isDown(key.SPACE))){ _root.score+=50; _root.streak+=1; unloadMovie(this)}if(_root.spacehitbad.hitTest(this)){ _root.score-=50; _root.streak=0; unloadMovie(this)}}
Where hitspace is the part where the note has to come in contact with when u hit the note. and spacehitbad is the back where if the note hits that it means you have missed the note.
I am trying to get a character to jump up when I press the spacebar and come down by himself but am having a dickens of a time doing so. Here's the code I am using: This is the LevelOne class, there is also a player class:
[Code]....
I got a character to move. I want the player to be able to move the character to a button then press spacebar on it. Which will take them to another frame.
This is the code I got for the button but the trouble is u can press spacebar anywhere to go to the next frame.
on (keyPress "<Space>") {
_root.gotoAndPlay(23);
}
When it starts, I switch tab to nr.2 (default is tab 1). I need to be able to hold down spacebar and drag the mouse to pan, but when I do this it switches back to the first tab. So the spacebar is triggering it to switch. I've tried using a custom lass that extends tabNavigator, like the code below, but it's not working. Also tried setting focusEnabled = false without luck.
[Code]...
THIS THREAD IS SOLVED.. Answer lies upon a website tutorial. Final Page on this Thread.So far so good, i've gotten most my as2 to as3.. And coming out good Buttons are working, The only last part im working on is upon shooting, it'll bring in the calls to Fire the missle.. (tracein the button works great).
[Code]...
This is what im trying.. But it says undefined use for addchild.. so im taking im missing somthing..
(the missile is a animation graphic i created).I have made a Missile.as to control what the missle does when its addchild is placed on stage. Problem is, (addchild isnt doing it) and im not sure if its going to shoot out the nose of the hero..
i've posted many times and got loads of responses but i dont understand how to make a bullet hole appear when you shoot an object. MSN me a [URL] to have a chat about doin the actionscript.
View 1 RepliesI have just read the tut on the shooting aspect of games and i tried it for myself. I altered it so that you shoot on the x axis and you shoot when the space button is pressed.My question is, how do you make the bullets shoot when the space button is releases? And or can make the bullet shoot at an interval of one second or so when the space is pressed... The bullets for me are shooting at a continuous streem and that may be a too great advantage for a user..
View 6 RepliesI am making a simple word processing widget, like this one: [URL] for my kindergarten classroom.
The problem is that the embedded font does not use a lined space when you hit the space bar. It makes a space. The lined space is created by hitting the "" key --just above enter. I have been trying to use a key listener to add the lined space to the text box when you hit the space bar. It works, only it also gives you the "space" created by the space bar.
Basically, on the stage is an input text box (myTextbox) with the font embedded. Here is my script:
Code:
stop();
var keyListener:Object = new Object();
makeSpace = function() {;
[Code]....
Is there a way to remove the space from the text before adding the lined space?
How would i make it so that i can make something move at an x/y coordinate and have it move there with ease?
View 1 RepliesThis is a code that I have on a movie clip:
onClipEvent(enterFrame){
if (Key.isDown(Key.SPACE)){
_root.acc = 2;[code]....
How do I make on key A - so you can press A instead of Space?
hey you wouldnt know how to make a gif play throught once when you press lets say space. i know the coding for to make button link to the animation but u have to hold it to for it to play throught once i want to make my char do a attack thing and i dont want to use toggle i want to press it like for halfd a sec and see about 2 secs of my char do his attack i have the gif, and i have it stoping at the end of the gif but is there a way to make it so i just have to press not hold?! heres my code
var rollSpeed = Number=14; var facingRight = true; ichigo_mc.onEnterFrame = function() { if (Key.isDown(Key.RIGHT)) { this._x += rollSpeed; this.gotoAndStop("right"); facingRight = true;
[code]......
How would i make it so that i can make something move at an x/y coordinate and have it move there with ease?
View 1 RepliesI am working on a program to draw something using dimensions input by the user. As the user changes these dimensions, the drawing changes to match. The problem I am facing is that it currently requires 15 textInputs to draw the image. I have them set up so that you can tab through them to enter the information quickly, then all of the drawing is done through ActionScript in the Submit button below the entry. However, when I enter 15 lines of information my instinct automatically presses enter to complete the process, every time. Now for my question. Is there a way to make a keystroke equal a button press? Or do I have to copy all 500 lines of code into a keystroke listener?
View 1 RepliesThis is what i have to do:
-Place 10 buttons on the screen
-Make 10 objects randomly move as i press each of the buttons.
eg: press button 1, object 1 moves to a random position press button 2, object 2 moves to a random position...
I'm trying to make a series of images move on button press. The first will appear on the stage when the pages loads. There will be a next button which will make the current image move off to the left of the stage and the next move in to the stage from the right and stop in the center. There are about 10 images.
I also have to do the same to another page but with text and moving in vertically instead of horizontally. I have posted this at the bottom (as the images one is too big to post). Although this version is the one I did with tweens that did'nt work, you can have a play with it if you like?
i need to make a certain movie clip play when i press a button.
View 4 Replieshow i can make the button when i press it do not load movie number twice(x2)?. and when you press again the button load the movie ,i just want to load just one time, the movie and when u click on it don't play again.
View 3 Repliesthis is in my bullet movie clip on the timeline.[code]It all works but when i turn around it still shoots the same way im sure its something simple but i just cant work it out.
View 7 Repliesim trying to make a game that requires you to have the spacebar and the right arrow key pressed to make the character move. However i just cant seem to link the 2 key presses together. when the keys are pressed individually it works and when theyre pressed together it works but i want the character to be inactive until both are down at the same time :/
i've tried everything that i can think of (which is kinda limited) i thought id cracked it with a 'while' statement but when i tested it flash would throw a fit and close heres the code that flash doesnt like, it looks (to me) like it should work but it clearly doesnt :P
PHP Code:
onClipEvent (load) {
_x = 0;
_y = 0;
}
[code]....
How can i make it so a when you press a button it starts a countdown but every other press dosent reset it?
View 14 RepliesI am attempting to make a small gallery of pictures that slide in from the right when i press the relevent button - which functions perfectly as it stands, here's the code structure on the main timelines 'actions' layer, but1, but2 etc are actual buttons and not MC's:
[Code]...
I have a problem when I making a game Flash with action script 3,. I want tomake my character move when the key helding and I want my character attackwith one tab press either
View 3 RepliesI have text field which is 0 by default (score_txt)Two buttons +1 and -1 (plus_btn and minus_btn) When I press +1 text increases by one, and when i press -1 it decreses
View 4 RepliesI have a TargetCirlce_mc which moves on "y" axis from top to bottom. And I have an arrow_mc which is on x:100 & y:200. How can I shoot an arrow exactly on the registration point of the TargetCircle_mc (automatically) while it is exactly opposite to the arrow_mc?
View 1 RepliesMy goal is to shoot a bullet everytime I click on ship. What happens, in fact, is that If I click on it once, the bullet is shot, but if I click on it twice before the first bullet is off the screen, the first bullet literally stops(it does not disappear, only stops) and the second bullet is shot.
public var ship:Ship = new Ship();
public var bullet:Bullet = new Bullet();
stage.addChild(ship);[code]...
I'm doing a simple game where you move the character using the arrow keys and shoot using the Mouse. The character rotates based on the Mouse angle. I have two problems: when I move the character, he moves once, then stops then moves again as normal. My other problem is that when I click over a MovieClip, the bullet goes to the wrong angle.My moving function:
Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
function keyHandler(event:KeyboardEvent):void {
[code]....
How do you make a flash movie where you press a button and a number (lts say three) appears in a text field?
View 6 Replies