Jump to content

Storing Coordinates


harrywatson
 Share

Recommended Posts

Hi all, I'm trying to store coordinates in an array and cycle through them on click.

 

I've stored the coordinates in an array and the event listener obediently changes

the y coordinate of my image but using the array index rather than the given values.

IE 0,1,2,3 instead of 50 -50 -150 -250

posa = 50;posb = -50;posc = -150;posd = -250; position  = [posa, posb, posc, posd];index = 0;clue1.addEventListener("click", function(event) {//clue1.y = posb;///////worksclue1.y = (index++)%(position.length);//alert(position);/////returns 50 -50 -150 -250//alert(clue1.y):////returns 0 1 2 3stage.update();});

You can see it not working here. You may have to reload as there is no preloading:   http://harrywatson.altervista.org/combination.html

 

Many thanks to those who take a look

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...