Using Functions

0 favourites
  • 9 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • After reading th manual, which was good at explaining what a function does, but not how to actually make one, I found this thread:

    scirra.com/forum/function-object-vs-function-plugin_topic59653.html That got me further to where I have a working function.

    However, I have other questions:

    1) Can a function be on a different event sheet (for organizational purposes)? I tried just making another event sheet and put my function there, but that didn't work.

    If the functions can't be put on a different event sheet, is there some way to put them 'out of the way' so that the event sheet isn't a mess when your scripting starts getting massive?

    2) When I created my function object, I called it 'OrbitCalc' But then I was asked to name it again in a window called "Parameters for Orbitcalc: On Function", with explanation text of "The name of the function that is being called." and a field labeled "Name". Didn't I name it 'OrbitCacl'? What is this extra bit of information for? I found that if the calling event (which also asks for this info) and the "Name" don't match, the function won't run. I don't understand what the extra step is for.

  • 1)Yes but it has to be imported into a worksheet that is attached to that layout (see manual)

    2)You assign the function first and give it a name.

    e.g. On mouse click call function "ShowMessage"

    Then you have to say what that function does so you call a function (in this case "ShowMessage" and tell it what you want it to do.

    dl.dropbox.com/u/25176763/function.capx

  • 1. Yes. Make sure to include event sheet with function to event sheet who call this function. - Right mouse click on event sheet editor and select "Include evant sheet.

    2.You named your function object in the layout editor - You have set global name for the object used in actions, conditions...

    simpe functions.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • dsarchy and shinkan:

    1) What you said makes sense, I'll try that. Thank you both.

    2) I am still confused after reading your replies to number 2 several times. Unfortunately, your examples you've supplied are both from version 117 and the free 114 version I have will not load them.

    Are you saying that the function object has a name, but it needs to be referred to by yet another name? This doesn't make sense to me.

  • 2) Are you saying that a function object can hold many functions, so you need to refer to a specific function inside the function object? That makes sense, if that's the case.

    What then delineates one function from another inside that function object when viewing them from an event sheet?

  • Ok, I think I've got it figured out. Thanks! I'm out of time but I'll post again if I have trouble getting my functions onto a separate event sheet.

  • dsarchy and shinkan:

    1) What you said makes sense, I'll try that. Thank you both.

    2) I am still confused after reading your replies to number 2 several times. Unfortunately, your examples you've supplied are both from version 117 and the free 114 version I have will not load them.

    Are you saying that the function object has a name, but it needs to be referred to by yet another name? This doesn't make sense to me.

    2) The name of function object is that, name of the object. You need only 1 function object in your project and you can use it to run all your functions. In event sheet you pick the function object and call function with `on function` name, not with name of the function object. Name of the function object is quite irrelevant for anything :-)

  • Thanks Vee41, that made perfect sense!

  • Shinkan: Thanks, Including the event sheet worked perfectly. This will make organizing everything much much easier. Kudos!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)