Jump to content

How to order 2 functions with the same input


AdamRyanGameDev
 Share

Recommended Posts

I have stared in the face of madness with this little problem, converting some old games from a different engine I used phases to space out calls, but I hadn-t realised this wouldn-t work with the underlying js...

eg I had a function with pointerdown that reset which sprite was selected

input.on('pointerdown', function...

following calling that function I LATER call a second function on pointerdown which relied on getting a possible new sprite selection (but the two functions couldnt be merged for technical purposes)

input.on('pointerdown', function

It didnt work well, it seemed the code was a click 'behind' , I tore my hair out, I drank coffee until i started itching all over, then i realised this was mitigated by a double click... ah ha! I simply made the second function pointerup.

input.on('pointerdown', function...
input.on('pointerup', function...

Ok  it isnt essential for me right now, but I would like to know how i could guarantee that two event driven functions are called in a certain order, is it possible? I appreciate this was probably javascript ignorance!

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