ScionOfWar
09-02-2008, 05:10 AM
Hello,
I'm new to flash programming and I've just begun my first complicated flash game. Everything's been working pretty well, but I've encountered a couple of problems which I can't find a solution to. I'm going to attach the .fla file so you can look at it and give me your opinion, but here's a description of what I'm struggling with:
First of all, the player symbol has code to shoot cannonballs, which'll hit towers on the map and cause them to stop. However, when I tried to attach code to the towers to give them independent respawning symbols, it also caused them to stop. What I mean by this is, the 'bullets' of the towers -hurt- the towers.
Secondly, I wanted to have the towers not technically shoot bullets, but a unit which'll chase the player around agressively. I was trying to use the code from another program earlier (which caused one symbol to chase the player symbol), and yet it won't trail my player properly. Instead, it goes directly to the place the player was and then stops abruptly. Here's the code attached to the symbol:
onClipEvent (keyDown) {
if (_root.player._x<_x) {
this._x -= 2; }}
onClipEvent (keyDown) {
if (_root.player._x>_x) {
this._x += 2; }}
onClipEvent (keyDown) {
if (_root.player._y>_y) {
this._y += 2; }}
onClipEvent (keyDown) {
if (_root.player._y<_y) {
this._y -= 2; }}
Thank you for the help, here's the link to my media share which contains my incomplete .fla file. Most of the work I've been doing is in layers 2 and 3 of "Scene 2"
http://www.mediafire.com/?xqu42uaif2y
I'm new to flash programming and I've just begun my first complicated flash game. Everything's been working pretty well, but I've encountered a couple of problems which I can't find a solution to. I'm going to attach the .fla file so you can look at it and give me your opinion, but here's a description of what I'm struggling with:
First of all, the player symbol has code to shoot cannonballs, which'll hit towers on the map and cause them to stop. However, when I tried to attach code to the towers to give them independent respawning symbols, it also caused them to stop. What I mean by this is, the 'bullets' of the towers -hurt- the towers.
Secondly, I wanted to have the towers not technically shoot bullets, but a unit which'll chase the player around agressively. I was trying to use the code from another program earlier (which caused one symbol to chase the player symbol), and yet it won't trail my player properly. Instead, it goes directly to the place the player was and then stops abruptly. Here's the code attached to the symbol:
onClipEvent (keyDown) {
if (_root.player._x<_x) {
this._x -= 2; }}
onClipEvent (keyDown) {
if (_root.player._x>_x) {
this._x += 2; }}
onClipEvent (keyDown) {
if (_root.player._y>_y) {
this._y += 2; }}
onClipEvent (keyDown) {
if (_root.player._y<_y) {
this._y -= 2; }}
Thank you for the help, here's the link to my media share which contains my incomplete .fla file. Most of the work I've been doing is in layers 2 and 3 of "Scene 2"
http://www.mediafire.com/?xqu42uaif2y