|
|
|||||
Topic, Flash CS4 Help | ||||||
| ||||||
You must register or log in to post a message.[edit] I made a custom one by re-arranging everything... (aminator, Development, ect) Copied from some forum.. xP it made too many disadvantages for me to consider it progress with it... [edit] operators are basic math they are: + plus - minus / divide * times ^ power, for root do: a^(1/b) like you would a^b for power % modulo, gets the remainder of a divide there are some other ones but they are binary operators and make my head explode, and are also pretty much useless... onEnterFrame=function() { } within the {} goes code that is run EVERY SINGLE TIME BEFORE IT UPDATES THE SCREEN, and is probably used in every game...there are basic functions: if() you can put equality checks, calls to functions, anything that returns a value in there, if it's true it runs the code in the {}, or if there isn't any {} the next line of code doesn't execute if it's false else this runs if the 'if' before it returned false paired with 'if' you get 'else if()' which you can guess what does for(start,check,loop) { } start: code run when beginning for loop check: like an if, returns true/false for code within loop: code run after the code in {} the code in {} is ran until the check parameter is false (may have names parameters wrong lol) example: for(a=0;a<10;++a) { trace(a*a) } output panel shows: 0 1 4 9 16 25 36 49 64 81 trace(text) sends text to the console while() { } like an 'if', but runs code over and over until the comparison within the () is false var varRight:Boolean = false; var varLeft:Boolean = false; var varUp:Boolean = false; var varDown:Boolean = false; var xspeed:Number = 5 var yspeed:Number = 5 function checkKeys(event:KeyboardEvent) { if (event.keyCode == 39) { //Right key is down varRight = true; } if (event.keyCode == 38) { //Up key is down varUp = true; } if (event.keyCode == 37) { //Left key is down varLeft = true; } if (event.keyCode == 40) { //Down key is down varDown = true; } } function keyUps(event:KeyboardEvent) { if (event.keyCode == 39) { event.keyCode = 0; varRight=false; //Right key is not down. } if (event.keyCode == 38) { event.keyCode = 0; varUp=false; //Up key is not down. } if (event.keyCode == 37) { event.keyCode = 0; varLeft=false; //Left key is not down. } if (event.keyCode == 40) { event.keyCode = 0; varDown=false; //Down key is not down. } } function movement(Event){ if (varRight == true) { player.x += xspeed; player.rotation = 0 } if (varUp == true) { player.y -= yspeed; player.rotation = -90 } if (varLeft == true) { player.x -= xspeed; player.rotation = 180; } if (varDown == true) { player.y += yspeed; player.rotation = 90; } } stage.addEventListener(Event.ENTER_FRAME, movement); stage.addEventListener(KeyboardEvent.KEY_DOWN , checkKeys); stage.addEventListener(KeyboardEvent.KEY_UP, keyUps); You type in code (ActionScript 2/3) there. xP I made pong in it(it was crap lfmao) and they were confused XP [edit] Im it can take many thousands of lines to make a good game, but great codists can cut them out sometimes and make great games in hundreds...but it's still a load of garbage to the average guy! function triangleNumber(number) { if(number>1) return triangleNumber(number-1)+number else return 1 } triangleNumber(1)=1 triangleNumber(2)=3 triangleNumber(3)=6 triangleNumber(4)=10 triangleNumber(5)=15 COMMENT YOUR CODE!!! I constantly get confused BY MY OWN CODE so it's VERY important to comment it, also if you leave a project for too long it can be better to start fresh so that your code will make more sense if you get confused at how your code works it's game over for that project XD [edit] Im what about interactive scrolling XP Even I know how to do that. xP And also I think your knowledge is less than 1%. :P I need pointers though... | Flash game developmentFirst post of the topic |