en el video salen algunos codigos:
Cita:
onClipEvent (load) {
power = 2;
radius = 6;
}
onClipEvent (enterFrame) {
/*...*/
}
}
power = 2;
radius = 6;
}
onClipEvent (enterFrame) {
/*...*/
}
}
Cita:
Iniciado por onClipEvent
/* mover personaje */
if (Key.isDown(Key.LEFT)) {
_x -= power;
}
if (Key.isDown(Key.RIGHT)) {
_x += power;
}
if (Key.isDown(Key.UP)) {
_y -= power;
}
if (Key.isDown(Key.DOWN)) {
_y += power;
}
/* wall anti choques */
while (_root.mc_wall.hitTest(_x, _y+radius, true)) {
_y--;
}
while (_root.mc_wall.hitTest(_x, _y-radius, true)) {
_y++;
}
while (_root.mc_wall.hitTest(_x-radius, _y, true)) {
_x++;
}
while (_root.mc_wall.hitTest(_x+radius, _y, true)) {
_x--;
}
/* cop (villano) */
if ((_root.mc_cop.mc_visor.hitTest(_x, _y+radius, true)) or (_root.mc_cop.mc_visor.hitTest(_x, _y-radius, true)) or (_root.mc_cop.mc_visor.hitTest(_x+radius, _y, true)) or (_root.mc_cop.mc_visor.hitTest(_x-radius, _y, true))) {
_x = 75;
_y = 75;
}
if ((_root.mc_cop.mc_head.hitTest(_x, _y+radius, true)) or (_root.mc_cop.mc_head.hitTest(_x, _y-radius, true)) or (_root.mc_cop.mc_head.hitTest(_x+radius, _y, true)) or (_root.mc_cop.mc_head.hitTest(_x-radius, _y, true))) {
_root.mc_cop.gotoAndStop(2);
}
/* teletransportador */
if ((_root.mc_test.hitTest(_x, _y+radius, true)) or (_root.mc_test.hitTest(_x, _y-radius, true)) or (_root.mc_test.hitTest(_x+radius, _y, true)) or (_root.test.hitTest(_x-radius, _y, true))) {
_x = 332;
_y = 74;
}
/* cambio de nivel */
if ((_root.mc_nivel.hitTest(_x, _y+radius, true)) or (_root.mc_nivel.hitTest(_x, _y-radius, true)) or (_root.mc_nivel.hitTest(_x+radius, _y, true)) or (_root.mc_nivel.hitTest(_x-radius, _y, true))) {
_root.mc_cop.gotoAndStop(5);
}
}
if (Key.isDown(Key.LEFT)) {
_x -= power;
}
if (Key.isDown(Key.RIGHT)) {
_x += power;
}
if (Key.isDown(Key.UP)) {
_y -= power;
}
if (Key.isDown(Key.DOWN)) {
_y += power;
}
/* wall anti choques */
while (_root.mc_wall.hitTest(_x, _y+radius, true)) {
_y--;
}
while (_root.mc_wall.hitTest(_x, _y-radius, true)) {
_y++;
}
while (_root.mc_wall.hitTest(_x-radius, _y, true)) {
_x++;
}
while (_root.mc_wall.hitTest(_x+radius, _y, true)) {
_x--;
}
/* cop (villano) */
if ((_root.mc_cop.mc_visor.hitTest(_x, _y+radius, true)) or (_root.mc_cop.mc_visor.hitTest(_x, _y-radius, true)) or (_root.mc_cop.mc_visor.hitTest(_x+radius, _y, true)) or (_root.mc_cop.mc_visor.hitTest(_x-radius, _y, true))) {
_x = 75;
_y = 75;
}
if ((_root.mc_cop.mc_head.hitTest(_x, _y+radius, true)) or (_root.mc_cop.mc_head.hitTest(_x, _y-radius, true)) or (_root.mc_cop.mc_head.hitTest(_x+radius, _y, true)) or (_root.mc_cop.mc_head.hitTest(_x-radius, _y, true))) {
_root.mc_cop.gotoAndStop(2);
}
/* teletransportador */
if ((_root.mc_test.hitTest(_x, _y+radius, true)) or (_root.mc_test.hitTest(_x, _y-radius, true)) or (_root.mc_test.hitTest(_x+radius, _y, true)) or (_root.test.hitTest(_x-radius, _y, true))) {
_x = 332;
_y = 74;
}
/* cambio de nivel */
if ((_root.mc_nivel.hitTest(_x, _y+radius, true)) or (_root.mc_nivel.hitTest(_x, _y-radius, true)) or (_root.mc_nivel.hitTest(_x+radius, _y, true)) or (_root.mc_nivel.hitTest(_x-radius, _y, true))) {
_root.mc_cop.gotoAndStop(5);
}
}
http://www.videobb.com/video/k0wYkojrgXRb