ok here's the deal i have cs5 i know how to use some of the basic flash stuff and i can draw pretty well with my tablet in photoshop but i would like to learn some basic gaming stuffs like having a symbol in flash move when you press a key and having other symbols interact (bullet hits bad guy, bad guy screams and his head explodes etc) i have some background with html but i doubt that that has anything to do with this. so basically i would just like to have somebody walk me through the basics.
i have some background with html but i doubt that that has anything to do with this.
The only time HTML is used in flash is for text formating i believe.
If you have any specific questions you can ask them here stackoverflow.com/
And here's a nice way to simulate gravity
Gravity, friction, elasticity, ect var exampleX:Number = 50; //our movie clips X postion var exampleY:Number = 200;//our movie clips Y postion var exampleS:Number = 20; //our movie clips speed var exampleV:Number = -1; // our movie clips velocity
//adding a movie clip to the stage var example:MovieClip = new exampleMC() addChild(example) example.x = exampleX example.y = exampleY
//running a function every frame addEventListener(Event.ENTER_FRAME, gravity, false, 0 ,true) //false, 0 , true, are used for garbage collection
function gravity(e:Event) { example.y = exampleY; exampleY -= exampleS; exampleS += exampleV; } /*what this function does is every frame add X to the MC's speed subtract Y from X slowing its path until X is a negative number and its path is reversed*/
function collision(e:Event) { if (example.hitTestObject(example2)) // test if our first MC touches our second MC { removeEventListener(Event.ENTER_FRAME, movement) //removes our other function making the ball stop } }
Just a thing to know about adding event listeners, UNLESS your planing to remove the event later, you should always add false, 0 , true to the end of that listener parameters
example: addEventListener(Event.ENTER_FRAME, example, false, 0 ,true)