- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
override protected function checkCollision():void
{
var allCollisionObjects:Object = (root as MovieClip).allCollisionObjects;
allCollisionObjects.setPropertyIsEnumerable("monsterHead", true);
allCollisionObjects.setPropertyIsEnumerable("item", false);
allCollisionObjects.setPropertyIsEnumerable("trashBin", true);
allCollisionObjects.setPropertyIsEnumerable("container", true);
allCollisionObjects.setPropertyIsEnumerable("platform", true);
allCollisionObjects.setPropertyIsEnumerable("elevatorToggleSwitch", true);
allCollisionObjects.setPropertyIsEnumerable("hero", false);
collision: for (var collisionObject in allCollisionObjects)//создаем метку главного цикла
{
for each (var targetObject:* in allCollisionObjects[collisionObject].array)
{
if (this.hitTestObject(targetObject))
{
switch (allCollisionObjects[collisionObject].name)
{
case CollisionWith.MONSTER_HEAD:
targetObject.reduceHealth(this.bullet.getDamage());
if (this.bullet is Morgenstern)
{
if (! targetObject.killed) targetObject.monsterheads::pushBack(direction);
else targetObject.monsterheads::alternativeDeath(direction);
}
break;
case CollisionWith.TRASH_BIN:
targetObject.collector.trashbin::remove(targetObject);
break;
case CollisionWith.CONTAINER:
if (this.bullet is Morgenstern) targetObject.sound.play(600);
break;
case CollisionWith.PLATFORM:
trace("hitted!!!");
break;
case CollisionWith.ELEVATOR_TOGGLE_SWITCH:
targetObject.parent.collector.elevator::toggleSwitch(targetObject);
break;
}
this.dispatchEvent(new Event(HITTED));
break collision;
}
}
}
}
}
}
динамически убираем из массива объекты, с кот. не сталкивается объект пуля
lammar 07.05.2012 00:05 # 0
lucidfoxGovno 07.05.2012 05:07 # −4
штык - вот пиздец
wvxvw 07.05.2012 12:29 # 0
HaskellGovno 07.05.2012 13:06 # −2