Under rating threshold (hideshow)
I don't understand why the code isn't var b:MovieClip = new Bullet()
Isn't it an undefined variable if we don't put :MovieClip????
Under rating threshold (hideshow)
that may be due to copy + paste...
also i wonder if c++ can be used in this? (if you konw please send me a messege on my profile)
Under rating threshold (hideshow)
@ Orangatang91:
The code "Keyboard.SPACE" finds the position in the array (don't quote me on that, It might not be an array) "Keyboard" ("Keyboard" is from that one line "import flash.ui.Keyboard") that is defined by the string "SPACE". At that position is a number. That number is 32. So, using "Keyboard.SPACE" is the same as using "32". So, when you type Key.isDown(32) it goes to the "Key" class that was defined and runs the function "isDown" with the parameter "32". Function "isDown" then returns a boolean value (boolean means true or false). *SOOO*, *if you want to use, say, "X" instead of "SPACE"* then you would have to look up some chart on the internet (I like http://preview.tinyurl.com/3o2wmgm). So instead of using "Keyboard.X", you must use "88" (Why 88? Who knows!). "Key.isDown(88)" is the line of code for you. Don't worry, it's a mistake that just about everyone has made, and I'm no exception. Please rate up if this was helpful.
Under rating threshold (hideshow)
Lol. I think that programming is my strong point, not art. I couldn't draw the bullet in the AS2 shootorials. But now it's easy as pie! XD
Under rating threshold (hideshow)
I wasn't a big fan of it either when I saw it in the original Shootorial... The part where shootDelimiter gets incremented every frame and set to zero when spacebar is pressed implies that the variable gets incremented unchecked forever as long as someone doesn't press spacebar... Which means it will eventually reach a value that the Number type cannot contain (an Overflow error). Ideally you could set the variable to 0 in the Ship() function, set it to 8 when spacebar is pressed (if the value is 0) and decrement it every frame if its value is not 0, thus stopping the overflow risk
Under rating threshold (hideshow)
Dear author: please put your opening brace of a function on the line after the declaration. That is all. (Thanks for the tutorials though) :)
Under rating threshold (hideshow)
Copied the code to the T ... but then when i add :
if(Key.isDown(Keyboard.SPACE) && shootLimiter > 8){
shootLimiter = 0;
var b = new Bullet();
stage.addChild(b);
b.x = this.x + 50;
b.y = this.y + 3;
}
my ship vanishes ... any solutions ?
Under rating threshold (hideshow)
I found that in CS5, the code should be : b.x = this.x + 120; b.y = this.y + 40; in order for the bullets to come out of the front of the ship, not +50 and +3. Hope this helps :D
Under rating threshold (hideshow)
Great Tut's Moly, its about time someone made an as3 shootorial. I mean Why would Kongregate? Almost all of their new API is AS3 exclusive. So good work 5/5
Under rating threshold (hideshow)
How can I use the x or f key instead of using the space key because Keyboard.X doesn't work using your keyboard class.
Under rating threshold (hideshow)
var b = new Bullet();
b.x = this.x;
b.y = this.y;
this tut is much better than the as2 version, but still I can see some porn... This must be in the constructor!
Under rating threshold (hideshow)
there is already a shootoorial 3, but thanks for the new tutorial. i learned in actionscript 2.0, and that was also good