PDA

View Full Version : Making a zombie game for my Level3 Game design class


UberMouse
06-21-2009, 09:47 AM
This seem's to be a nice community that provides help to most people, But I might be asking a bit too much if so pointing me to some tutorial's or a way to find out how to do it would be nice.
Anyway I haven't been using flash that long I have just a basic character (A ball ;) ) and he's moving around aiming at mouse etc. The next thing I need to work on is switching weapons and picking up weapons from the ground. Can anyone help me with that?

rrh
06-22-2009, 01:54 AM
What do they teach you in this class?

wibily
06-22-2009, 08:48 PM
uh oh, this sounds like a design class whereas what you are describing is more of a programming problem

neways here's a couple of tutorials i found really helpful

http://www.senocular.com/flash/tutorials/as3withflashcs3/ - this one taught me flash

http://www.gotoandplay.it/_articles/2007/02/game_tutorial_part1.php - this one teaches a lot about collision detection

otherwise if you want to buy something
Essential ActionScript 3.0 isn't bad

bluemagica
06-23-2009, 12:47 PM
get "Actionscript3.0 Game Design Academy", it is an excellent book with various practical game examples that will get you started with all sorts of games(including multiplayer)!

picking a weapon and switching is as simple as changing the value of a variable, but it's useless to explain unless you understand a bit more of the basics of programming!

UberMouse
06-24-2009, 08:48 AM
What do they teach you in this class?

uh oh, this sounds like a design class whereas what you are describing is more of a programming problem

neways here's a couple of tutorials i found really helpful

http://www.senocular.com/flash/tutorials/as3withflashcs3/ - this one taught me flash

http://www.gotoandplay.it/_articles/2007/02/game_tutorial_part1.php - this one teaches a lot about collision detection

otherwise if you want to buy something
Essential ActionScript 3.0 isn't bad

get "Actionscript3.0 Game Design Academy", it is an excellent book with various practical game examples that will get you started with all sorts of games(including multiplayer)!

picking a weapon and switching is as simple as changing the value of a variable, but it's useless to explain unless you understand a bit more of the basics of programming!

In reply to
1. I've missed the first 1 and half term's of the class which is 4 term's long and where they taught most of the programming (Which was javascript) but most of the stuff they were teaching I already mostly knew.

2. The programming isn't really the problem I'm just making a more advanced game then I need because I actually want to make a good game lol

3. I already know the basics of programming I'm just not to familiar with actionscript "Actionscript3.0 Game Design Academy" that book sounds usefull I'll be sure to pick it up somewhere.

EDIT
Couldn't find Actionscript3.0 Game Design Academy on the internet is there a better link?

bluemagica
06-24-2009, 11:54 AM
hmm, you sound like you are a bit too confident about your programming skills! I don't want to be rude, but when working in flash and actionscript, if you don't know actionscript itself, then it doesn't matter how good you are with javascript or anything else. If programming wasn't a problem, you wouldn't be visiting here. So settle down and start learning as3... learning new stuff never hurts

As for the book, i forgot that the name was for our local version....worlwide its available under different name, heres the link:- http://www.amazon.com/ActionScript-3-0-Game-Programming-University/dp/0789737027

rrh
06-24-2009, 04:43 PM
Wibily posted a good tutorial. It's targetted to people who know AS2 learning AS3, but it should still be good for someone new to actionscript entirely.

UberMouse
06-24-2009, 08:31 PM
hmm, you sound like you are a bit too confident about your programming skills! I don't want to be rude, but when working in flash and actionscript, if you don't know actionscript itself, then it doesn't matter how good you are with javascript or anything else. If programming wasn't a problem, you wouldn't be visiting here. So settle down and start learning as3... learning new stuff never hurts

As for the book, i forgot that the name was for our local version....worlwide its available under different name, heres the link:- http://www.amazon.com/ActionScript-3-0-Game-Programming-University/dp/0789737027

What I meant was in the class programming is not the problem I could easily make a much simpler game that would be enough for the class but I don't want to I wan't to make a game that's actually fun to play . And I do already have that book it has multi player? I do also believe I know how to do weapon switching the thing I have been working on trying to get working is having the camera scroll with the main character. I know ctionScript-3-0-Game-Programming-University cover's that in 3 of the tutorial's but none of the code seem's to work for me.

bluemagica
06-25-2009, 08:22 AM
in that case, show the code you have tried to do yourself, and we might tell you where your mistakes are!

UberMouse
06-25-2009, 09:37 AM
Here is my game.
The weapon switching code I'm working on is commented out in player.as it currently crashes the game I've had no success in it. The only semi working code I had was running twice and resetting the switched weapon. Basically for the weapon switching I have an array of the current weapons in you're possession max of 2 and when tab is pressed change a string variable called currentWeapon to the other value in the array.
So if you have:
["MP5","M4A1"] in the current weapon array and:
"MP5" as the current weapon. When you press tab I wish to switch to the currentWeapon string to "M4A1".
Thanks for any help guy's.

P.S Also I have the scrolling working so don't worry about it.

rrh
06-25-2009, 03:53 PM
//Not working weapon switching
if (key.isDown(key.LEFT))
{
var i:Number = 0;
while ( i < currentWeaponArray.length)
if (currentWeapon == currentWeaponArray[i]);
{
if (currentWeaponArray[i+1] != null)
{
if ( i < 1)
{
currentWeapon = currentWeaponArray[i+1];
}
}
else
{
if (currentWeaponArray[-1] != null)
{
currentWeapon = currentWeaponArray[i-1];
}
}
}
i++;
}
What's it doing instead of working? Is it timing out and asking you to halt the script? You may need to take a look at the control flow, in terms of what statements are inside of what loop and/or conditional, and what will happen depending on the state of the array, the value of i, etc.

UberMouse
06-25-2009, 08:17 PM
//Not working weapon switching
if (key.isDown(key.LEFT))
{
var i:Number = 0;
while ( i < currentWeaponArray.length)
if (currentWeapon == currentWeaponArray[i]);
{
if (currentWeaponArray[i+1] != null)
{
if ( i < 1)
{
currentWeapon = currentWeaponArray[i+1];
}
}
else
{
//Missing the i here I noticed
if (currentWeaponArray[i-1] != null)
{
currentWeapon = currentWeaponArray[i-1];
}
}
}
i++;
}
What's it doing instead of working? Is it timing out and asking you to halt the script? You may need to take a look at the control flow, in terms of what statements are inside of what loop and/or conditional, and what will happen depending on the state of the array, the value of i, etc.

It just crashes the game as soon as I press left. I'm assuming it's looping endlessly and most of that code was written after a 9 hour school day :eek: so It's not the best.

UberMouse
06-26-2009, 09:25 AM
Ok I think I have figured out the weapon switching using this code
if (key.isDown(key.LEFT))
{
trace(currentWeapon + " Start");
if (currentWeapon == 0)
{
currentWeapon = 1;
trace(currentWeapon + " If");
}
else
{
currentWeapon = 0;
trace(currentWeapon + " Else");
}
}

But I still have the problem that it run's the code twice when you press left I'm presuming it's because it's held down for too long is there a way to fix that so it only run's once per key press?

It output's this when left is pressed

0 Start
1 If
1 Start
0 Else

bluemagica
06-26-2009, 01:16 PM
just use a boolean to see key status,

var can_switch = true;
if(key.isDown(key.LEFT) and can_switch==true)
{
can_switch=false;
///rest of your code
}
if(!key.isDown(key.LEFT) and can_switch==false)
{
can_switch=true;
}

UberMouse
06-26-2009, 10:27 PM
Dam I did try that, Just not that way so it didn't work.

UberMouse
06-26-2009, 11:35 PM
Yay thanks I just tried it work's perfectly now I just need to add shooting :)