The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.
The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.
3 | 4443 |
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.
Heres how to check for collisions
var example:MovieClip = new exampleMC()
addChild(example)
example.x = 50
example.y = 100
var example2:MovieClip = new exampleMC()
addChild(example2)
example2.x = 400
example2.y = 100
addEventListener(Event.ENTER_FRAME, movement)
function movement(e:Event)
{
example.x += 4; //just moves our first MC foward
}
addEventListener(Event.ENTER_FRAME, collision, false, 0 ,true)
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)
You must be logged in to post a reply!