Jump to content

Using var from other function in 'update'


micouy
 Share

Recommended Posts

Hi, it's my first time here and my first game. I don't know much about javascript also.

My problem is that I set a variable 'rockUp' to create sprite in my function addRocks and I want to use x of this sprite in 'update' to add points. Function addRocks is called by a looped timer set in 'create', so it can't detect x of that sprite correctly.

What do I have to do?

code: drive.google.com/file/d/0B2GJjU5fsrlgZEV3Y2F2dTJEelk/view

(sorry for my english)

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...