|
-
Help with a variable
Okay I am working in flash Cs3, working on designing a game. I have the basic workings down but I cannot seem to get my variables to set more then one value (i=1, i<200, ++i).
this is the code on the hit box around the character, and it is supposed to stop him when he hits walls. However, the only instance name that works, within the ["wall"+i] is wall1.
Actionscript Code:
onClipEvent (load) { stop(); [B]i = (i=1, i<200, i++);[/B]
} onClipEvent (enterFrame) {
if (hitTest(_root["wall"+i])) { if (Key.isDown(Key.UP)) { _root["wall"+i]._y -= 10; _root["roof"+i]._y -= 10; } if (Key.isDown(key.RIGHT)) { _root["wall"+i]._x += 10; _root["roof"+i]._x += 10; } if (Key.isDown(key.LEFT)) { _root["wall"+i]._x -= 10; _root["roof"+i]._x -= 10; } if (Key.isDown(key.DOWN)) { _root["wall"+i]._y += 10; _root["roof"+i]._y += 10; } } }
The bold is where I seem to be having my problem, I have set the value of i, but when i actually use it, the only value that seems to be initialized is i having a value of 1. does anyone know how i might be able to fix this and or another way I can make a hit test for the walls that will not need a seperate string of coding for each individual wall?
thank you in advance.
if you need anything else just ask.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|