A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: [RESOLVED] my variable isnt registering as a variable

Threaded View

  1. #1
    Member
    Join Date
    Oct 2009
    Posts
    30

    resolved [RESOLVED] my variable isnt registering as a variable

    my variable is "objectHeight"+i
    depending on what i is the variable becomes
    objectHeight1
    objectHeight2
    objectHeight3
    etc
    the problem is that its not registering as a variable
    edit:
    by variable becomes i don't mean what its equal to but the name of the variable.

    Ignore the top and the title. I'm gonna try to explain it the best i can now.
    Lets say im trying to make a "targeting" system for a rpg game or something.

    PHP Code:
    if (target == 1){
        
    enemy_hp1 -= 20
    }
    if (
    target == 2){
        
    enemy_hp2 -= 20

    instead of doing that for every enemy i want to do something like this. (obvoiusly it's not correct)
    PHP Code:
    ["enemy_hp"+target] -=20 
    Last edited by HanTV; 12-30-2009 at 09:07 PM. Reason: being more clear

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center