Help With Game Actionscript
plz help me out with this 1 i have 5 targets that start off the screen and (below)i want them to go to the top so you have a chance to shoot them.but i want to make them go back to the bottom and start over again if they were not hit.so would i just let it loop? and then add actionscript saying something like if target is hit then loop without target1?? ne 1 know what i should put
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 08-21-2005, 05:13 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Moving A Game From Actionscript 1.0 To Actionscript 2.0...
Hi there.
I hope someone can help me out here. I have been asked to create a simple Flash memory game, and I have been given a template to use as a basis. However, this template has been created in Actionscript 1.0 for Flash player 5. I now need to transfer it over to Actionscript 2.0 Flash player 8, and Ive noticed lots of odd behaviour once it has been changed.
Here is the code....
Code:
initGame();
stop();
function initGame() {
// make sorted list of cards
cardsListOrdered = [];
for (i=1; i<=18; i++) {
cardsListOrdered.push(i, i);
}
// shuffle list
cardsListSorted = [];
while (cardsListOrdered.length>0) {
r = int(Math.random()*cardsListOrdered.length);
cardsListSorted.push(cardsListOrdered[r]);
cardsListOrdered.splice(r, 1);
}
// create card clips and assign their location and picture
x = 0;
y = 0;
for (i=0; i<36; i++) {
attachMovie("Card", "Card"+i, i);
_root["Card"+i].picture = cardsListSorted[i];
_root["Card"+i]._x = x*60+200;
_root["Card"+i]._y = y*60+50;
// move to next card spot
x++;
if (x>5) {
x = 0;
y++;
}
}
firstclip = 0;
}
function clickCard(clip) {
// see if two card are showing
if (secondclip != 0) {
// turn those two cards back over
firstclip.enabled = true;
secondclip.enabled = true;
firstclip.gotoAndStop(1);
secondclip.gotoAndStop(1);
firstclip = 0;
secondclip = 0;
}
// see if same card was clicked
if (firstclip == clip) {
// turn card back over
firstclip.gotoAndStop(1);
firstclip = 0;
// see if no cards are showing
} else if (firstclip == 0) {
// turn first card over
clip.gotoAndStop(clip.picture+1);
firstclip = clip;
firstclip.enabled = false;
// must be one card showing
} else {
// turn second card over
clip.gotoAndStop(clip.picture+1);
secondclip = clip;
secondclip.enabled = false;
// see if two cards match
if (firstclip.picture == secondclip.picture) {
// Disable both cards
firstclip.enabled = false;
secondclip.enabled = false;
firstclip = 0;
secondclip = 0;
}
}
}
When set to FlashPlayer5, all works well. If a player tries clicking the same tile twice, it stops them. Also, when a pair of tiles are uncovered, again, the user is no-longer able to press them. This was done using the "enabled = false".
However, when I change it to Flash Player 8, none of these seems to work. Ill include the .fla so someone could possibly play around with it and see where the problem is, or whether there is another way to do it....
Hope someone can help.
Many thanks
Game Actionscript - Help
Hi All
Okay here goes....
I am creating a game a bit similar to what would be found within "girlie" magazines.
There are 5 questions in all with 4 possible answers(a,b, c, D) the user is able to select a combination of any choice within each question,depending on whether the user has more of one combination at the end of the quiz the, resulting image is shown
So say the user clicks more a's than the rest then an image will appear,
if the user clicks on the same number of a's and b's then another image will appear,
so essentially there will be a seperate resulting image at the end depending on results for the following:
a - image
b - image
c - image
D - image
A + B = image
A + C = image
B + C = image
C + D = image
B + D = image
A + D = image
can anyone out there help ???? Please
Really would need a source file....bgroves sent me a file similar to this for another poroject, this time it is alot more complex......
please help
urgent
thanks
J
(bgroves - have u seen this before i know you are familiar with this thanks....)
Please Help - Game -ActionScript
Can anyone help me in this game file.
I need to create a scene or a frame with a button.
When I click on the button the Game should start to play.
This FLA game file has lots of action script.
Since I am not able to upload the file please use this below link to access the FLA file
Thanks for the great help
http://www.flashkit.com/movies/Games...7765/index.php
Thanks once again
Game Actionscript
I need help. I need an actionscript for hit-testing. I need it so that when a movie clip hits another movieclip(ie.balls falling into a basket)the "ball" dissapears. Since I am quite new with flash I was hoping that you cuold help me out. Thanks.
Game Actionscript
hey, does anyone know how to make enemies take a certain amount of shots when an object (eg bullet) hits them, so they die when the are hit 3 times or whatever, cheers.
Actionscript For A Game
Hey all,
This is a loaded question, so I hope someone can help. I'm creating a game for a cd-rom. Not very intense, however what I'm trying to do is the following:
1. Have 12 questions appear randomly throughout game.
2. Each question might have 2-5 possible answers.
3. When the possible answer is clicked on feedback will appear next to it stating whether it's true or false.
4. I don't want to use external files to load because the game is very visual and I want a specific font to show, as well as graphics appear.
5. My main goal would be to have the user click on the appropriate responses. Either True or False appears in graphic form along with a textual feedback and a check mark appearing next to the True answers.
6. When all answers have been clicked on a movie clip will appear telling the user to move to the next page.
Breakdown:
Random Q&A's
Actionscript checking to see if all answers have been clicked on
Answers have check marks beside them, and
Once all have been answered correctly a movie clip plays on the screen to proceed.
As you can tell I'm a designer, not a programmer, but do have actionscript experience, so I'll understand the verbage. Thank you!
Brian
Can Anyone Help With Some Actionscript To My Little Game...MX
I have attached a fla file. In the file I explain what the idear is .... I hope some of you can help me ...its a little school-math-game to my class. But Im not soo experienced in actionscript.
Maybe you can help a lot, maybe you can help with some of it. fx how to get 4 different math in random mode (see the fla)
I would be very happy, if someone could help me......
Help Me With A GAME ActionScript
Hi there...
well, i´m making a platform game... like super mario style... and i´m with some difficults to make the enemies walk in the platforms arround the scene level.
To each platform are created a random name that are made with the name "platform" and with a random number
example: "platform4826473916"
//******* CODE:
this._name="platform"+Number(random(9999999999));
ok, but know, the enemies need to recognise these platforms names... So i need a coomand to put on hitTest that get all the platform names.
since "Platform0" to "Platform9999999999"
I´ve tried some codes but not work like:
//******* CODE:
plat="_root.platform"+Number.POSITIVE_INFINITY
if(this.hitTest(plat){
}
Can some1 help me with it?
If you need the .FLA file to take a look, i can attach it here...
Thanx!!!!
Actionscript Game HELP
Note : I am useing Flash MX Professional 2004 and Flash MX
Alright, I am making a game with a fellow flash artist with the forum name "Soul_Sketcher". He makes the art work, while I do the programming. Sound fair.
alright, heres my question. Theres a dude that chases after the charcter you control. I'll put the actions down for him. (instance name is "Player" btw)Theres a dude thats chasing him. Now, I want it so that when the "Enemy" touches the "player", it goes to a different frame, or scene. Now, I probally am just over looking something, but i cant seem to find out how to do this. HELP!
Players Actionscript (the guy you control) :
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
_y -= 10;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.DOWN)) {
_y -= -10;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= 10;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_x -= -10;
}
}
onClipEvent (enterFrame) { if (this.hitTest(_root.enemy)) { _root.player.Play (); }}
ENEMY'S Acrtioscript (The dude that chases after you) :
onClipEvent (enterFrame) {
if (_root.player._x>_x) {
_x += 5;
}
}
onClipEvent (enterFrame) {
if (_root.player._x<_x) {
_x -= 5;
}
}
onClipEvent (enterFrame) {
if (_root.player._y>_y) {
_y += 5;
}
}
onClipEvent (enterFrame) {
if (_root.player._y<_y) {
_y -= 5;
}
}
ALRIGHY, now, can someone edit the actionscript so that when the enemy touches the player, it goes to another scene. Please? I though i knew how to do this! I made this a long time ago, from another game and i TOTALLY forgot what to do, lol. (I think this has something to do with the whole (enterframe) part i left out )
HELP~ Game On Actionscript
hi... i need some actionscript help, the problem are as follow.
thank you!
Regards
---- what this game is about ----
on the left hand bottom, there will be a screen to show wat the user need to catch... so when the user catch the correct one it will give 5 points, if the user catch the wrong one then it will not add any points.
---- problems ----
1. it couldnt detect which is the right or the wrong one.. and score were all wrong
Scenario 1: when i catch the wrong one, it sometimes add score and sometime dont
Scenario 2: when i catch the right one, sometimes it add double score and sometime correct, and sometime dont.
---- my following codes ----
code:
onClipEvent (load) {
var timevariable = 0;
var previousPulley = 1;
//default symbol
_root.sm3AmPulleySystem._visible = true
_root.sm3AmMovablePulley._visible = false
_root.sm3AmFixedPulley._visible = false
}
onClipEvent (enterFrame) {
timevariable = timevariable+1;
if (timevariable == 13) {
_root.Timer = _root.Timer-1;
timevariable = 0;
}
if (_root.Timer==0) {
_root.gameend = true;
}
speed = 30;
if (Key.isDown(Key.LEFT) ) {
_x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
if (_x<185) {
_x = 185;
}
if (_x>495) {
_x = 495;
}
randomobject = random(3)
if(_root.gameContainer.hitTest(_root.fixWorker.fix ) or _root.gameContainer.hitTest(_root.moveWorker.moves s) or _root.gameContainer.hitTest(_root.systemWorker.sys tem)){
if(previousPulley == 1 and (_root.gameContainer.hitTest(_root.systemWorker.sy stem))){
_root.Score = _root.Score + 5;
}else if(previousPulley == 2 and (_root.gameContainer.hitTest(_root.moveWorker.move ss))){
_root.Score = _root.Score + 5;
}else if(previousPulley == 0 and (_root.gameContainer.hitTest(_root.fixWorker.fix)) ){
_root.Score = _root.Score + 5;
}
if(randomobject == 1){
previousPulley = 1;
_root.sm3AmPulleySystem._visible = true
_root.sm3AmMovablePulley._visible = false
_root.sm3AmFixedPulley._visible = false
}else if(randomobject == 2){
previousPulley = 2;
_root.sm3AmPulleySystem._visible = false
_root.sm3AmMovablePulley._visible = true
_root.sm3AmFixedPulley._visible = false
}else if(randomobject == 0){
previousPulley = 0;
_root.sm3AmPulleySystem._visible = false
_root.sm3AmMovablePulley._visible = false
_root.sm3AmFixedPulley._visible = true
}
}
}
}
Actionscript Help In Game
i am working on a game called "virus".
you click somewhere on the screen and the virus goes to where you click.
you have to dodge random moving white blood cells, and if you hit them you lose. everything is working. except for one thing.
scoring.
i have made a movieclip with a dynamic textbox in (score), and in the movie clip there is a section where the number in the score textbox goes up really quickly, a section where is goes up medium, and a section where it goes up slowly.
i want to make it so that when you get closer to the center of the movie, for the score to go up quicly, and slower as you get further out.
i have tried hittest with movie clips in the centre of the stage, but it doesnt seem to work.
i have flash mx 2004.
help very much appreciated. thanks a lot in advance!
Game Actionscript - Help
Can anyone out there lend a hand. I don't know much about actionscript and I'm trying to customize this game for my little bro. Basically I want the head_mc to triger it's animation when the pinch_mc fingers overlap and pinch together.
Here is a link that may help to explain.
--> http://homepage.mac.com/jasoninch/game/test.htm
Please let me know if more detailed explanation is needed.
Any help with this would be greatly appreciated.
Thanks . j
Attach Code
--------- STAGE A.S. ---------
stop();
Mouse.hide();
score = 0;
misses = 0;
pinch = 0;
--------- HEAD MC ---------
onClipEvent (enterFrame) {
if ((this.hitTest("_root.pinch") == true && pinch==1)) {
play();
}
}
---------PINCH MC---------
onClipEvent (enterFrame) {
setProperty(this, _x, _root._xmouse);
setProperty(this, _y, _root._ymouse);
this.onMouseDown = function () {
play();
pinch = 1;
}
}
[F8] Actionscript Help For Game
I have a couple questions. I know how to add score with a button and i know how to make a health bar, but i need to know how that score would only go up if you pressed it at a certain time and if it wasnt pressed at the right time, the health meter would go down. Also, If you do press it at the right time the health bar would go up. Thanks
Game In Actionscript
Hi everyone iam new to this thread.
Wanted to know how to program a small game like puzzle bob (a game where in various colored bubbles come down from the top and you have a gun shooting each bubble at a time, when three same colored bubbles are joined together it then pops) game in actionscript.
I know the basics of trignometry how i do use it to make the game using actionscript.
If any one of u have experiences in making a game like that pls guide.
Ash.
Actionscript- Right For A Game?
I'm trying to code a Fable style game, but im trying to decide whether to use C++, or Action-Script.. I know some C++ but im totally unfamiliar with Actionscript. I'd be glad do learn actionscript, but which do you think is easier or better for the task?
Thanks, SoulEdge
Game 100% By Actionscript Try It
This isnt exactly a game but i will be using it to help me make some in the future.
I have been spending a while practacing flash 8 at the age of 13, here is what i have managed to do with no help from other websites sofar. Copy and paste this code on the first frame on a blank page (white background, 550 x 400, 120 fps)
PHP Code:
createEmptyMovieClip("ball", 1);
ball.lineStyle(1.5, 0x0000FF);
ball.beginFill(0x0000FF, 50);
ball.moveTo(11, -11);
ball.curveTo(15.5, -6.4, 15.5, 0);
ball.curveTo(15.5, 6.4, 11, 11);
ball.curveTo(6.4, 15.5, 0, 15.5);
ball.curveTo(-6.4, 15.5, -11, 11);
ball.curveTo(-15.5, 6.4, -15.5, 0);
ball.curveTo(-15.5, -6.4, -11, -11);
ball.curveTo(-6.4, -15.5, 0, -15.5);
ball.curveTo(6.4, -15.5, 11, -11);
ball.moveTo(0, -15.5);
ball.lineTo(0, 15.5);
ball.moveTo(-15.5, 0);
ball.lineTo(15.5, 0);
ball.endFill();
ball._x = 275;
ball._y = 175;
createTextField("xpos", 3, 0, 0, 100, 45);
xpos.selectable = false;
xpos._x = 90;
xpos._y = 15.5;
createTextField("ypos", 4, 0, 0, 100, 45);
ypos.selectable = false;
ypos._x = 245;
ypos._y = 15.5;
var rspeed:Number = 0;
var lspeed:Number = 0;
var dspeed:Number = 0;
var uspeed:Number = 0;
//
var backgroundaplha:Number = 5;
var friction:Number = 0.02;
var speedofball:Number = 0.1;
var pressalplha:Number = 70;
var releaseaplha:Number = 100;
//
createEmptyMovieClip("border", 2);
border.lineStyle(3, 0x000000, 50);
border.beginFill(0x8B60FF, backgroundaplha);
border.lineTo(550, 0);
border.lineTo(550, 400);
border.lineTo(0, 400);
border.lineTo(0, 0);
border.endFill();
var ballscale = 300;
ball._xscale = ballscale;
ball._yscale = ballscale;
onEnterFrame = function () {
xpos.text = "X Position: " + ball._x;
ypos.text = "Y Position: " + ball._y;
if (Key.isDown(Key.LEFT)) {
lspeed -= speedofball;
}
if (Key.isDown(Key.RIGHT)) {
rspeed += speedofball;
}
if (Key.isDown(Key.UP)) {
uspeed -= speedofball;
}
if (Key.isDown(Key.DOWN)) {
dspeed += speedofball;
}
ball._x += rspeed;
ball._x += lspeed;
ball._rotation += rspeed;
ball._rotation += lspeed;
ball._y += uspeed;
ball._y += dspeed;
if (rspeed > 0) {
rspeed -= friction;
}
if (lspeed < 0) {
lspeed += friction;
}
if (uspeed < 0) {
uspeed += friction;
}
if (dspeed > 0) {
dspeed -= friction;
}
if (ball._x >= 500) {
ball._x = 60;
}
if (ball._x <= 50) {
ball._x = 500;
}
if (ball._y >= 350) {
ball._y = 60;
}
if (ball._y <= 50) {
ball._y = 350;
}
ball.onPress = function() {
startDrag(this, true);
ball._alpha = pressalplha;
rspeed = 0;
lspeed = 0;
dspeed = 0;
uspeed = 0;
};
ball.onRelease = function() {
stopDrag();
ball._alpha = releaseaplha;
};
};
You can drag the ball around and move it around with the arrow keys.
Could someone please tell me how i could make it so that instead of teleporting the ball when it touches the sides, it smoothly bounces instead ?
Actionscript Game Help
Hi all!
I’m trying to develop a game with Actionscript, but I’ve run into a string of maddening technical difficulties that my limited programming knowledge presently cannot overcome. I’d like to know Actionscript like the back of my hand, but lately that’s starting to look like a pipe dream.
Anyhow, the game I’m working on is in the style of The Terminator/Operation Wolf arcade games. There is a playable character that can moved with the keyboard, and the mouse behaves as a targeting reticule, with which the player will rollover and click the enemies to kill them.
I am having a difficult time trying to accomplish the following (this is with Actionscript 2.0, mind you):
1. Randomly generated enemy characters that spawn on either side of the screen, and move automatically from one side of the screen to the other. I've currently got them to generate randomly in a range of positions, but I can't seem to get them to move in any direction. These characters are being generated from an array. Deleting the array doesn't seem to work.
2. I want these same enemy characters to remove themselves from the stage when the game is over. The “Game Over” screen is in a scene separate from the main game. For some reason, I can get my player character to disappear using removeMovieClip, but not the enemy characters, which again, are being generated from an array.
I’ve tried a whole mess of things that seem to work in theory, but not in execution. If anyone should care to come to my rescue, I would greatly appreciate it. Feel free to let me know what other information I can provide to help you help me!
Thanks so much in advance!
-
Phandral
Can Anyone Help With Some Actionscript To My Little Game...MX
I have attached a swf file. In the file I explain what the idear is .... I hope some of you can help me ...its a little school-math-game to my class. But Im not soo experienced in actionscript.
Maybe you can help a lot, maybe you can help with some of it. fx how to get 4 different math in random mode (see the fla)
I would be very happy, if someone could help me......
Game Actionscript
ok i want to make one of those games with stickmen walking around. I made a movie clip with a stickmen that looks like hes walking and he need to know if there is a big actionscriopt code that will make my guy walk on the ground randomly and when you clck him he falls on the ground and bleeds.
any help i will much aprecciate
http://media.putfile.com/walking78
Game In ActionScript
I am attaching a simple action script
my question is when i press a button the ball goes up and after a certain distance it come back
i hav used hittest but i need to know how to control the ball
for example when the ball is mooving up and hittest occurs i want the ball to come down to its initial position from where it started
but if hittest occurs when the ball is comming down i want hittest to occur
but i am finding it difficult pls help me out
regards
prasanth
waiting for ur valuable reply at the earliest
Actionscript Countdown For A Game?
I am looking for an actionscript countdown for a game i am building. Idealy it will display the remaining time in minutes, seconds and hundreds of a second, ie countdown from 1:59.99.
I will also need a function to check the remaining time, so when time reaches 0:00.00 i can call an end game movie.
Any help would be much appreciated, and a mention on the credits if you can provide a solution.
Cheers,
10224 (lozza)
Actionscript Adventure Game
This is the code I am using for this man on my MovieonClipEvent (load) {
move = 0;
lock = true;
}
onClipEvent (keyDown) {
this.hero.play();
}
onClipEvent (keyUp) {
this.stance.gotoAndStop(1);
}
onClipEvent (enterFrame) {
if (move == 0) {
if (lock) {
this._x += Xstep;
Ystep = 0;
Xstep = 0;
if (Key.isDown(Key.LEFT)) {
Xstep = -10;
Ystep = 0;
this.gotoAndStop("left");
} else if (Key.isDown(Key.RIGHT)) {
Xstep = 10;
Ystep = 0;
this.gotoAndStop("right");
}
}
}
}
onClipEvent (enterFrame) {
render();
}
onClipEvent (load) {
moveSpeed = 10;
}
I have four different thing what my man can do walk right walk left shoot right shoot left this is the code i have what is on the movie
on (keyPress "o") {
tellTarget ("/hero") {
gotoAndStop (4);
}
}
on (keyPress "p") {
tellTarget ("/hero") {
gotoAndStop (5);
}
}
That is how the actionscript is What I need to know is how do i make the actionscript when i let go of the button that it goes back to just standing which the frame label is called stance can anyone help?
Yet Again More Actionscript Help Needed W/ Game.
FLA:
http://cp1.myhostdns.org/~hellfusi/u...uraengine4.fla
===========
This is a action game I've been working on for a few weeks now with the help/advice of many from the Flashkit community: JTNX, ihoss, Marmotte, etc you guys know who you all are!
I'm still working on it and at a stump again because I can't figure out how to accomplish some things in my game right now so I'm here again asking for help.
Things I don't know how to do and want to find tutorials for:
- Teleport: Being able to have my character walk to the next screen when he approaches and exit or wants to walk towards the next room, for example.
- Spells: You might notice that animated tornado. Yep... I want to have enemies cast magic basically. The tornado would just move towards the middle point of the stage and go back. I'm also curious to figure out how to make something appear around the enemy to signify that he/she/it is casting a spell. Would you place an object, set the x-y coordinates to the enemy object? How would this be accomplished?
- Points: Being able to pick up a simple object on the ground that accumulates into the points box above.
As always, help is greatly appreciated. Thanks again.
ActionScript Needed For A Game
Hello, i am going to make a game where your mouse is a mallet and you smash bunny rabbits. I already have the swinging mallet part down, but i don;t know how to do the bunny rabbits, i want it so they run around the screen and when they get clicked on they splatter everywhere.
Ne help i will greatly appreciate!
[help] Stuck On Actionscript Help For My Game
This is my first flash game and I've looked, but couldn't find tutorials for the coding I want to do so I've been really struggling trying to guess where stuff goes and piecing individual tutorials together- I'm doing good but i have two problems:
1) when the laser hits the spaceship then you lose a life, when all lifes are gone then game over.
code: onClipEvent (load) {
var lives = 3;
function reset(){
this._y=-15;
this._x=random(400);
enemySpeed=random(10)+5;
}
reset();
}
onClipEvent (enterFrame) {
this._y+=enemySpeed;
if (this.hitTest( _root.spaceship ) ){
lives-=1
}
if (lives < 3) {
removeMovieClip(Life3);
}
if (lives < 2) {
removeMovieClip(Life2);
}
if (lives < 1) {
gotoAndPlay(517);
}
if (this._y>450) {
reset();
}
if (this.hitTest( _root.spaceship ) ){
removeMovieClip(this);
}
}
2) I have a power bar, I make it go up and down like I want but I can't make it go to the frames like it should.
code: onClipEvent(load){
dropSpeed=10;
upSpeed=3;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.CONTROL) and this._y<400) {
this._y+=dropSpeed;
} else if (Key.isDown(Key.SHIFT) and this._y>245) {
this._y-=upSpeed;
}
if (this._y>395) {
gotoAndPlay(118);
} else if (this._y<240) {
gotoAndPlay(211);
}
}
if someone could help me out with that or tell me how to make variables work please tell me because it seems like they don't do anything for me other than keep tract (I've already tried to switch frames based on score, but couldn't get it to even though scoring worked great)
Help Actionscript Audio For A Game
I am trying to add sound efx to this flash MX racing game. I have my sound file and I have checked the "export for actionscpiting" and the "export in first frame", but I can not get the sound to work. I have a trace line in there to make sure that the code was being executed and it was, but still no sound. The code below is attached to a movie clip.
On clipevent(enterframe) {
....A whole lot more code that you don't need to see....
if (_root.track.crunchers.hittest(frontpos[0].x,frontpos[0].y,true) & !collide)
{// CAR BOUNCES BACK ON IMPACT ARCADEY FEEL
//play collide sound
collideSound = newsound();
collideSound.attachSound("Collision_boing");
collideSound.setvolume(100);
collideSound.start();
trace("Collide Boing play");
speed = -speed*bounceback
vector[0]= -vector[0]
vector[1]= -vector[1]
collide = true;
}
... continuation of more code...
Why can't I get the audio to play? I have tried making a function in the first frame of the movie and just calling that function to play the sound and that also does not work for me. Please help!!!!
I am looking for any suggestions. I am sure there is something simple that I am missing.
Help Actionscript Audio For A Game
I am trying to add sound to this Flash game. I am using Flash MX (2003) The script is in a movie clip under on clipevent(enterframe). I have the soundfile and I have checked the 'export for actionscripting' and 'export in first frame'. I put a trace line in there to make sure that the code was being executed. It is being executed and everything works other than I never hear audio.
Here is short bit of my code.
if (_root.track.crunchers.hittest(frontpos[0].x,frontpos[0].y,true) & !collide)
{// CAR BOUNCES BACK ON IMPACT ARCADEY FEEL
//play collide sound
collideSound = newsound();
collideSound.attachSound("Collision_boing");
collideSound.setvolume(100);
collideSound.start();
trace("Collide Boing play");
speed = -speed*bounceback
vector[0]= -vector[0]
vector[1]= -vector[1]
collide = true;
}
There is obviously some code before and after this, but I thought this might help. I am sure I am missing something simple so someone plese help.
Fun Actionscript Forum Game
A saw this on the bit-101 forums... and It sounds fun!
Add a line to the following code. next person can add another line, or change an existing line.
SIMPLE LINES PLEASE!
no ? : operators. no embedded statements. if you create an "if" block, you can only specify the conditional, not the content! If you make a for loop, same thing. just the loop, not the content. let it build up slowly.
This code is code that can be placed STRAIGHT onto the first frame of a blank file. Please KEEP it that way.
here's the seed:
Code:
createEmptyMovieClip("thing", 0);
Help With Platform Game Actionscript
I'm a newbie with actionscipt so sorry if the problem is really simple. I'm working on a platform game (Like super mario) and I have a hero, "man" and a platform. You can move left and right with the arrow keys and jump with the up arrow. My problem is that when I jump, my hero keeps on falling past the platform beacuse the hitTest doesn't seem to be working.
Code in frame, it is filled with functions that the mc calls:
Code:
stop();
function initGame() {
speed = 5;
bounce = 5;
JumpMax = 10;
JumpSpeed = 0;
flight = 0;
}
//-------------------------------------------------------|
//Movement-----------------------------------------------|
//-------------------------------------------------------|
function moveMan() {
if (Key.isDown(Key.RIGHT)) {
man._x = man._x+speed;
man.gotoAndStop("moveright");
} else if (Key.isDown(Key.LEFT)) {
man._x = man._x-speed;
man.gotoAndStop("moveleft");
} else if (Key.isDown(Key.UP)) {
if (flight == 0) {
flight = 1;
JumpSpeed = JumpMax;
}
} else {
man.gotoAndStop("normal");
}
if (flight == 1) {
man._y = man._y-JumpSpeed;
if (JumpSpeed>(0-20)) {
JumpSpeed = JumpSpeed-1;
}
}
//-------------------------------------------------------|
//Boundries----------------------------------------------|
//-------------------------------------------------------|
if (man.hitTest(north)) {
man._y = man._y+bounce;
speed = 0;
JumpSpeed = 0;
} else if (man.hitTest(south)) {
man._y = man._y-bounce;
speed = 0;
JumpSpeed = 0;
} else if (man.hitTest(west)) {
man._x = man._x+bounce;
speed = 0;
JumpSpeed = 0;
} else if (man.hitTest(east)) {
man._x = man._x-bounce;
speed = 0;
JumpSpeed = 0;
}
}
speed is the speed for moving left and right, JumpSpeed is for jumping. flight is either 0 or 1, it tells whether the character is jumping at the moment or not.
This is in the platform MC:
Code:
onClipEvent (enterFrame) {
if (flight == 1) {
if (me.hitTest(man._x, man._y, true)) {
flight = 0;
JumpSpeed = 0;
man._y = me._y;
}
}
}
Do you see any problems?
Thanks,
Eastwinn
PS: I'm running on Flash MX Pro 2004
Shooter Game Actionscript Help
Hi. I have a Sniper style shooting game on Flash 8 and i have a problem. it has a crosshair and the aim of the game is to shoot the guy. one prob is tho that when it reloads you can still shoot the guy. i believe that i need to add a "wait" script in it somewher but i dont know where. here is the actionscript for the crosshair
onClipEvent (enterFrame) {
startDrag(this, true);
Mouse.hide();
}
onClipEvent (mouseDown) {
if (_root.bullet == true) {
this.gotoAndPlay(2);
_root.bullet = false;
tellTarget (_parent.bulet) {
gotoAndStop(2);
}
}
}
where whould i add it.
if you would like the fla file to see what i need to do i would be happy to send it to you.
Thanks
Sterockicy
Actionscript Game 2.0 Question
Okay so I got Cartoonsmarts Isometric RPG tutorials.. and I am working through them. At first the coding was simple.. I got the little character to follow the mouse pointer.. but after adding the code to get him to walk .. WHAM!! I can't seem to make it work correctly.
When I click somewhere on the map... he doesn't go to where the pointer is... he just kind of wanders ... some time in the direction of the mouse.. sometimes not....
I am not sure if I should post the code since the code looks like the stuff in the tutorial. So what would help, code, the entire file?
Any insight to gt my guy to walk straight (besides to get him to give up drinking) would be great!
I Need Actionscript For A Game-its Complicated.
I do hope someone will be able to tell the code for this, as ive been to many other actionscript related websites that cannot help me.
Ok, this is done in flash8, take into account.
The game starts off with a long movie clip, but somewhere near the end of it, you have a certin time to enter in a code. If you do not enter in the code in time, nothing happens, the movie just stops(game over)
But if you do enter in the right code, lets say enter in "hello", then you press "enter" the movie restarts.
I have no idea how to do this.
I have the movieclip finished, i just need to add the actionscript at a ceryin frame of the movie that will allow you to enter in the code.
So how do i do that, and how do i tell the computer the correct code that restarts the movie once you press enter?
And how do i tell the computer that if you enter in the wrong code and press enter, it goes to the last frame of the movie(game over)
Its some difficult script, but i badly need it.
PLEASE HELP ME.
And if you do help me, lay it out in steps.
Thanks.
PS: I reliese that i posted this already but i found out that it was in the wrong section(http://www.actionscript.org/forums/s...950#post500950)
Sorry bout' that.
Simple Actionscript Game Help
I'm working on a simple AS game. snowflakes drop from the sky and then a penguin at the bottom gets points for eating them.
It's really pretty simple. But I have two questions.
FIRST QUESTION:
This code creates 10 randomly placed duplicate snowflake movie clips
for(var i=0;i<9;i++)
This code at the bottom tests that the snowflake hits the tingue of the penguin: if (penguin.tongue.hitTest(snowflake1._x, snowflake1._y)) {
I put "snowflake1" in as the movie name to test it, but really I want it to work on all 10 snowflakes. Is there an easy way to write this out without writing it 10 times for each instance name?
SECOND QUESTON:
on key down and hold it moves the penguin once, pauses, then starts moving continuously. Is there a way to write it so it won't pause after the first move?
Code:
for(var i=0;i<9;i++) {
snowflake.duplicateMovieClip("snowflake"+i,i);
}
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
//prevImage();
trace(penguin._x);
currentx=penguin._x;
penguin._x=currentx-6;
trace("left");
} else if (Key.getCode() == Key.RIGHT) {
//nextImage();
trace(penguin._x);
currentx=penguin._x;
penguin._x=currentx+6;
trace("right");
}
};
Key.addListener(listen);
/////////////////////////////////////
totalscore=0;
this.onEnterFrame = function() {
trace("snow x "+ snowflake1._x);
if (penguin.tongue.hitTest(snowflake1._x, snowflake1._y)) {
snowflake1._y = -(Math.random()*452); // this recycles the snowflake
totalscore+=100;
trace("score " + totalscore);
}
};
3D Game Using Flash Cs3 And Actionscript 3
Hi all,
I want to make a 3D game using flash cs3 and actionscript 3. Is it possible? Can anyone give me any hints how to start, if i need any component to install, any good book I can read, etc?
Thank You In Advance
Zelda Game Actionscript Help
Hello.
I'm basically a "noob" when it comes to actionscripting. I have only done copy x paste scripting, never really went into the whole learning process of AS'ing.
After viewing a recent flash that tested "what video game character are you" which can be viewed on the website " http://liquidgeneration.com " over the Quizzes section, I decided to make an adventure game.
Now this quiz will generate what kind of character you are by asking you personal questions and calculating the score.
What I had in mind was to have a Zelda game (big fan) in which there will be 4 questions each encounter with a monster, sort of like this:
BIG MOTH ATTACKS!!
What will you do?
a)hack at the limbs with your sword
b)concentrate magic power for a devastating magic attack
c)throw large rocks at the creature
d)enable the help of the spirits
so then each one of these will add a +1 to what the person is going to be. Say for example he chooses A;
berserker = 1
magician = 0
creator = 0
totemic = 0
but if he chose B;
berserker = 0
magician = 1
creator = 0
totemic = 0
And so on so forth.
Of course this will not show in-game but the the script is tracking the player's choices(does this connect to variables in any way I do not know).
so at the end of the game, the scores will turn up like this for example:
b = 100
m = 65
c = 43
t = 42
So at the end, the game states that the character is a "berserk" class. This is because he chose the most answers that gave +1 to the berserk statistics. This is how I assume flash-quiz makers produce their games.
Before I ask you for any assistance, please take to heart the fact that I'm only 13 years old. If you require some clarification with some areas of my explanation, feel free to ask.
/*ActionScript Help*/ Puzzle Game
I have recently completed a puzzle game, and it seems to be working fine. The only problem I have had (or been unable to fix) is that when I go to a different scene, the last puzzle peice that has been placed remains for the rest of the Flash movie.
Does anyone know how to fix this problem?
Your help would be greatly appreciated!
Thanks,
Lee.
Simple Help With Actionscript For Game
ok... im making a nav bar with a game attached. i want to have the character running around, and then you zap them. i have the whole button thing down, but i need help with the actionscript. i want the person to be moving slowly across the area, going back and forth at random heghts. this is what i have so far.....
Code:
onClipEvent (load) {
_root.hitz = 0;
this._alpha = 0;
}
onClipEvent (enterFrame) {
this._x -= _root.speedz;
this._rotation += 0;
if (this._x<=-80) {
this._alpha = 100;
}
if (this._x<=-380 && _root.hitz == 0) {
gotoAndPlay(2);
_root.missed += 1;
_root.hitz = 1;
}
if (_root._currentframe == 3) {
_parent.nextFrame();
}
}
im new at this whole actionscript thing, so dont be suprised if i made a huge mistake. if its any help, im basin it off of this tutorial. http://www.layoutgalaxy.com/html/htm...er47-page1.htm
thanks for looking.
Making A Game(actionscript)
i want to make a game similar to hungry hungry hippos. how would make random balls bouncing around and when it goes into the area of the mouth the player can eat it? and then at the end it will have a record of how many was eaten
Game Actionscript Test
I would like some people to make up a test not to hard to to simple.
So that i can see if my skillz are true to see if i can actually do some good stuff.
Anyone up to makin me a test
Actionscript HELP Gun/game Thingy?
Alright guys sorry for the aqward title i didnt know what to put for the title
Ok anyways alright im making a little game and i have pretty much all the knowledge i need, and have tested everything out, now theres one last thing i need! Ok i want to make my game have an object at the bottom of the screen (lets say a gun) and when i have my mouse in around the middle of the screen i want the gun to be in the middle and when my mouse is on the left side of the screen i want the gun to scroll over there with my mouse as it moves, also maybe have the tip of the gun pointing twords the mouse but i want the gun to stay on its x axis and move only with its x axis and not use its y axis if you know what i mean!
Please if anyone can help me please post, and if you have any further questions please feel free to ask, thx sooo much in advance to anyone who attempts to help me and everything!
Please Some1 Help With GAME ACTIONSCRIPT
Hi every1. If anybody can change the code in my game and get it to work I will give them £20. I cant upload the fla as it is too big by 100kb and don't know hot o make it smaller. I have uploaded the published thing.
If any1 thinks they can help I can emal them the fla.
I think there is only a small prob with code but I can't get it to work . The problem is that the game has a timer that runs down, if you can't complete the game in the time (ie the timer runs to 0 seconds) the "game over" page should appear. The "game over" page does appear but the game itself doesnt go. Anyway if anybody can fix the code I promise i will give them £20 reward cos I am going nuts with this code! Thanks.
Crossword Game With Actionscript
Hi there,
I want to create a crossword game in Flash that users can type in their answers in the boxes. Is it possible to write such a game using actionscript? Anyone done anything like this before?
Thanks
HELP HitTest In Actionscript Game
Hi all. I'm quite a Noob to Flash, and actionscript, and have recently been asked to develop an educational game. I looked at a fall and catch game, which encorporates multiplication and numbers in the game.
However i am having a little trouble with the hit test. I have a movie clip of the item 'num', which is added every 45 frames, and is animated to drop.
I have a character which is called char_mc which is movable (left and right) with the keyboard.
I have This code for the hitTest, and have tried putting this in different parts of the script too.
Code:
if(this.hitTest(_root.char_mc)) {//Hit test to see if the new drop hits the charactor (i.e user has caught the item)
score +=1;//increment the score by 1 if it does hit
trace("hit");//output the message hit if it's a hit
}
else //else decrese the score by one
{
score -=1;
}
I can post code up and even the FLA if required.
I'm sorry if i'm being a bit vague but hopefully someone can help me. Thanks in advanced
Simple Help With Actionscript For Game
ok... im making a nav bar with a game attached. i want to have the character running around, and then you zap them. i have the whole button thing down, but i need help with the actionscript. i want the person to be moving slowly across the area, going back and forth at random heghts. this is what i have so far.....
Code:
onClipEvent (load) {
_root.hitz = 0;
this._alpha = 0;
}
onClipEvent (enterFrame) {
this._x -= _root.speedz;
this._rotation += 0;
if (this._x<=-80) {
this._alpha = 100;
}
if (this._x<=-380 && _root.hitz == 0) {
gotoAndPlay(2);
_root.missed += 1;
_root.hitz = 1;
}
if (_root._currentframe == 3) {
_parent.nextFrame();
}
}
im new at this whole actionscript thing, so dont be suprised if i made a huge mistake. if its any help, im basin it off of this tutorial. http://www.layoutgalaxy.com/html/htm...er47-page1.htm
thanks for looking.
Actionscript HELP Gun/game Thingy?
Alright guys sorry for the aqward title i didnt know what to put for the title
Ok anyways alright im making a little game and i have pretty much all the knowledge i need, and have tested everything out, now theres one last thing i need! Ok i want to make my game have an object at the bottom of the screen (lets say a gun) and when i have my mouse in around the middle of the screen i want the gun to be in the middle and when my mouse is on the left side of the screen i want the gun to scroll over there with my mouse as it moves, also maybe have the tip of the gun pointing twords the mouse but i want the gun to stay on its x axis and move only with its x axis and not use its y axis if you know what i mean!
Please if anyone can help me please post, and if you have any further questions please feel free to ask, thx sooo much in advance to anyone who attempts to help me and everything!
Please Some1 Help With GAME ACTIONSCRIPT
Hi every1. If anybody can change the code in my game and get it to work I will give them £20. I cant upload the fla as it is too big by 100kb and don't know hot o make it smaller. I have uploaded the published thing.
If any1 thinks they can help I can emal them the fla.
I think there is only a small prob with code but I can't get it to work . The problem is that the game has a timer that runs down, if you can't complete the game in the time (ie the timer runs to 0 seconds) the "game over" page should appear. The "game over" page does appear but the game itself doesnt go. Anyway if anybody can fix the code I promise i will give them £20 reward cos I am going nuts with this code! Thanks.
Actionscript+game+ A Seesaw
Hi. I am very new to Flash AS but I have been trying to create a game that will have a seesaw effect.
So that when the first character jumps off the top platform onto the seesaw the second character will fly up off the seesaw and onto the top platform. I tried just a simple ' if (Key.isDown(Key.SPACE)) {
_x =' ,with a hitTest, ect....
but that doesn't seem to work very well. That also just moves the character straight down or up and it doesn't appear as though they are actualy jumping.
Is there a specific way of doing this? AM i going about this the right way? or am i completely off base.
I would really appreciate any help. I am desperate.
Thanks!
|