WidgetBucks - Trend Watch - WidgetBucks.com


User Options
Register--Login--Top 20 Posters--Search Topics


Forum Main>>Flash tutorials>>Basic shooting game

New Topic-Reply

Author
Post
Archbob
Rank:
Group: Head Administrator
Posts: 194
IP Logged

PM ID: 2
PM [Archbob]

Last replied to on Thu Jun 23, 2011 12:57:38
Edit Post|Quote
This thread is to discuss the tutorial "Basic shooting game" listed Here

Kirby
Rank:
Group: members
Posts: 3
IP Logged
PM ID: 106
[PM Kirby]

Posted at Tue Aug 14, 2007 17:56:09
Edit post|Quote
Hey, I have a problem. I followed the tutorial exactly as it read, but when I test out the movie in flash, I'm unable to shoot the enemy. Any help? Thanks.

Archbob
Rank:
Group: Head Administrator
Posts: 194
IP Logged
PM ID: 2
[PM Archbob]

Posted at Wed Aug 15, 2007 10:29:49
Edit post|Quote
Can you describe your problem a little better? What part of the shooting enemies are you having trouble with?

Kirby
Rank:
Group: members
Posts: 3
IP Logged
PM ID: 106
[PM Kirby]

Posted at Wed Aug 15, 2007 12:22:49
Edit post|Quote
Well, I copied the scripts as they were, but I changed some values(such as the symbol name).

I don't know if that's the problem, but when the game is loaded, it is impossible to fire. The enemy just continues running across the screen even when shot. I don't know if that cleared anything up.

Archbob
Rank:
Group: Head Administrator
Posts: 194
IP Logged
PM ID: 2
[PM Archbob]

Posted at Wed Aug 15, 2007 14:02:39
Edit post|Quote
If you change the symbol name, you must change all references to the symbol, otherwise the collision detection won't work.

Kirby
Rank:
Group: members
Posts: 3
IP Logged
PM ID: 106
[PM Kirby]

Posted at Wed Aug 15, 2007 15:44:23
Edit post|Quote
I did so. I even attempted to remake it, using the symbol name as "face".

But, I think the problem I'm having is when I need to add a the action script to the main time. Does the script create the other frames for you, or do I add them? If so, keyframes/frames?

Sorry for all the trouble.

Archbob
Rank:
Group: Head Administrator
Posts: 194
IP Logged
PM ID: 2
[PM Archbob]

Posted at Fri Aug 17, 2007 01:18:37
Edit post|Quote
What code did you add?

mindtrix
Rank:
Group: members
Posts: 8
IP Logged
PM ID: 132
[PM mindtrix]

Posted at Tue Oct 09, 2007 09:25:24
Edit post|Quote
hi folks first off id like to say thank you for this tut it works really well i followed it thru and i had no issues what so ever and my game is working fine.

the reason i am posting is because now i have the shooting game working i would like to add a scoring system to it but i have no clue where to start is there any chance of some help with this?

Archbob
Rank:
Group: Head Administrator
Posts: 194
IP Logged
PM ID: 2
[PM Archbob]

Posted at Tue Oct 09, 2007 12:00:29
Edit post|Quote
You need to add a variable called score first and then increment that score by 10 every time a face is killed. To show the score, you would use an dynamic text-box.

mindtrix
Rank:
Group: members
Posts: 8
IP Logged
PM ID: 132
[PM mindtrix]

Posted at Wed Oct 10, 2007 04:31:07
Edit post|Quote
do you have the action script for that?

Archbob
Rank:
Group: Head Administrator
Posts: 194
IP Logged
PM ID: 2
[PM Archbob]

Posted at Thu Oct 11, 2007 02:29:09
Edit post|Quote
Not in my tutorials, but its pretty easy to do. You don't actually need any action script for it. Just make a new variable called score in the main timeframe and do something like score=score+10 when an enemy dies.

serpent
Rank:
Group: members
Posts: 3
IP Logged
PM ID: 136
[PM serpent]

Posted at Thu Oct 11, 2007 08:05:24
Edit post|Quote
Hey i just followed this tutorial and it works well except for one problem

the spawned faces completely disregard what layer they are on and spawn on the first layer, this is an issue for me as i want to have them falling behind a cliff when i shoot them.

how would one go about fixing this?

mindtrix
Rank:
Group: members
Posts: 8
IP Logged
PM ID: 132
[PM mindtrix]

Posted at Thu Oct 11, 2007 09:24:03
Edit post|Quote
honsetly i have no clue what you mean m8, i have made a new layer in the main timeline called score and i have a dynamic txt box with the var as score now what do i do? where would i have to put "score=score+10"

Archbob
Rank:
Group: Head Administrator
Posts: 194
IP Logged
PM ID: 2
[PM Archbob]

Posted at Thu Oct 11, 2007 12:38:06
Edit post|Quote
Put the score in the hitTest of when the smiley gets shot. There's onclick event that detects a hitTest between the smiley and the crosshair put _root.score+=10 there.

As for the layer question, you can always specify a depths in the duplicate movie Clip function and change the cliff depths by using swapDepths().

mindtrix
Rank:
Group: members
Posts: 8
IP Logged
PM ID: 132
[PM mindtrix]

Posted at Thu Oct 11, 2007 17:31:05
Edit post|Quote
im not sure ive got this right because now its only registering the first hit and not counting any others!

heres my code mybe you can see whats wrong
thank you very much for your time and help.

Code:

onClipEvent (load) {
startDrag(this, true);
Mouse.hide();
this.swapDepths(9999);


}
onClipEvent(mouseDown)
{

playsounds = new Sound(this);
playsounds.attachSound("shot");
playsounds.start(0, 1);
playsounds.start(0, 1);
for(i=1;i<=5;i++)

{
if(this.hitTest(_root["face"+i])&&_root["face"+i].dead==0)
{
_root["face"+i].gotoAndPlay(2);
_root.score=+10
}
}
}


Archbob
Rank:
Group: Head Administrator
Posts: 194
IP Logged
PM ID: 2
[PM Archbob]

Posted at Thu Oct 11, 2007 21:04:40
Edit post|Quote
You got this reversed:
Code:

root["face"+i].gotoAndPlay(2);
_root.score=+10

Flip those two lines around.

serpent
Rank:
Group: members
Posts: 3
IP Logged
PM ID: 136
[PM serpent]

Posted at Fri Oct 12, 2007 01:21:48
Edit post|Quote
hey, thanks for the help so far with pointing me towards swap depth

i have just tested swap depths with the faces going behind a square box, and it does not work
however if i was to get two items say
greenbox
redbox
and make a button that swaps between the two, this works

could you please tell me where exactly the swapdepth code should go?

mindtrix
Rank:
Group: members
Posts: 8
IP Logged
PM ID: 132
[PM mindtrix]

Posted at Fri Oct 12, 2007 04:43:21
Edit post|Quote
thanks Archbob that works the only thing is that it only counts once how do i make it keep on couting up? ive left the link to my game so you can see what i mean but basicly it will count the score for the first hit but no others.

http://www.potheaduk.com/shootinggame.swf

serpent
Rank:
Group: members
Posts: 3
IP Logged
PM ID: 136
[PM serpent]

Posted at Fri Oct 12, 2007 10:32:37
Edit post|Quote
still having issues with swapdepth

as for score here is how you fix it

replace
_root.score = +10;
with
_root.score +=10;

and in the first frame put
score = 0;


Archbob
Rank:
Group: Head Administrator
Posts: 194
IP Logged
PM ID: 2
[PM Archbob]

Posted at Fri Oct 12, 2007 11:32:31
Edit post|Quote
For the cliff move clip, do this in the onClipEvent(load) part:

Code:

this.swapDepths(9998)


mindtrix
Rank:
Group: members
Posts: 8
IP Logged
PM ID: 132
[PM mindtrix]

Posted at Fri Oct 12, 2007 12:46:04
Edit post|Quote
serpent you are the man thankyou that sorted it out

Page: 1 2 3  >>   Last



Powered by © Chipmunk Board