Results 1 to 1 of 1

Thread: Trying to animate Objects in a array. All mimic the last Obj created?

  1. #1
    Join Date
    Aug 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Trying to animate Objects in a array. All mimic the last Obj created?

    I'm new to JavaScript, but not programming in general. Please take a look at the source
    And let me know if anyone knows how I should fix this.

    The problem is I have created an object, or an array of objects rather. Everything
    works great until the bugs turn either right or left. They all do they're own
    thing, just like intended, and the animations work for both right and left. But,
    All the objects in the array mimic the last object created. So when it turns,
    they turn. Regardless of direction. All the objects move bout independently but, the
    animation is basically a clone of the last one.

    I am using the Image control to do the animations. and when dealing with each object
    (Boundry checking, Movement, etc), I reference them from the array one by one.

    Does anyone have any ideas what I'm doing wrong? I fear the structure of the application
    is all wrong for the endeavor I have chosen, since I'm new to the language. And
    I may have gone about dealing with the objects all wrong. I've been trying to
    figure this out for 2 days now and I've thought about maybe an array of Image controls
    so each bug has his own control for the animation. But then doing it the way I did it
    Id need an object for each control... and that totally defeats the purpose of OOP.
    Right? I also thought about adding animation methods to the object so each instance
    handles its own Flying... but I cant call the controls from the method.

    So If anyone can point me in the right direction Id greatly appreciate it.

    The script and images are attached.

    Thanks,
    Danny
    Attached Files Attached Files
    Last edited by ddc.73; 08-14-2014 at 05:25 PM. Reason: Too much info.

Similar Threads

  1. Sort array of objects
    By SMartin91 in forum Java
    Replies: 0
    Last Post: 04-22-2009, 12:44 AM
  2. Replies: 2
    Last Post: 12-09-2008, 03:02 PM
  3. Replies: 8
    Last Post: 04-29-2008, 03:34 PM
  4. access events of objects in an array
    By ReMaX in forum JavaScript
    Replies: 5
    Last Post: 01-14-2008, 06:14 PM
  5. Array Objects Question
    By 7079 in forum JavaScript
    Replies: 3
    Last Post: 06-30-2006, 03:13 PM

Bookmarks

Posting Permissions

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