Rhindon's Forum Posts

  • blackhornet - Excellent examples. THANK YOU! That made things so much clearer.

    I don't think the UID example will work for my purposes but the Function.Call() example I think I can use.

    Ashley, Magistross, blackhornet - You three have been very help. Thank you for your patience with me.

  • First, thank you, EVERYONE.

    And Magistross has it right.

    What you all have shared makes enough sense so far in as much as a single variable is concerned. But I'm dealing with four distinct groups of two variables that come into play each time my Ship collides with the related power-up object. Depending on which power-up is hit, that will determine which pair of variables are called and put into the parameters section. So the trick/problem I face is how to pass the ReturnValue BACK to the appropriate variables AS defined in the parameters during the Function call.

    I will check out Hornet's examples and see if that doesn't answer my questions further.

    Thanks again!

  • Ashley - Thank you for responding.

    Well, see, this is where I am having so much trouble with Functions - on one hand I get them in concept and on the other I'm baffled about the application and such... So if I sound confusing, it's because I'm genuinely confused and trying to work this out, myself, and figure out the limitations and abilities of Functions within C2.

    So...based on what you showed there in your example, let me see if I can spell this out to confirm if I've got the deal straight in my head...

    EVENT CONDITION X IS TRUE:

    --> Set Ship.Experience to Function.Call("CalculateExperience", Ship.Experience)

    The Function is called and processed (as I have displayed in my screenshot above). In the actual Function instructions, it's told to process info for parameter 0, which, in this example, is Ship.Experience. The data is processed, and somewhere in my actual Function instructions I tell it push the parameter 0 value back to the Ship.Experience parameter.

    Correct?

    My question is then what happens when the parameter 0 is a different variable? Can I tell the Function to push the value back to variable declared in the parameter 0 at the time of the Function call during the specific runtime of the Function without having to specific each instance variable of the Ship within the Function instructions?

    If that still doesn't make sense, I'll try to draw up a visual diagram of my thoughts because I tend to be visual on these things anyway.

    Thanks!

  • Aaaah. I sorta understand. A bit more than before. Basically, using a Function here isn't going to help me as I thought since I still need a way to pass specific information BACK to the variables being set to the parameters..."pass by reference", as you said. (Or do I have that backwards? ...wouldn't surprise me.)

    At any rate, Ashley, would it be possible to add this feature to future C2 Functions or perhaps to C3 as you progress on that? It really would be awesome to be able to cut down on events and just specify WHICH detail to affect when each detail is addressed in the same way and the only conditions are which detail gets used at any given time.

    Anyway, thank you both! At least now I know my hangup is much less on my understanding of Functions and more on the fact that Functions can't do (in C2) what I was trying to attempt.

  • Okay...I'm NOT understanding...

    Even if I pick the UID within the Function, I'm still left with how to set the value of the parameter back to variable originally sourced as the parameter.

    Here's where I'm getting lost on how to set this up...

    Object Ship has 8 instance variables - an EXP and a LVL each for Speed, Rate, Calibre, and Spread.

    Whenever a power-up is collected, I want to run the "WeaponLeveling" Function which will check for the value of the EXP and LVL variables.

    So I'll have something like this...

    On Collision with PowerupSpeed... Call Function "WeaponLeveling" (SpeedEXP, SpeedLVL)

    On Collision with PowerupRate... Call Function "WeaponLeveling" (RateEXP, RateLVL)

    On Collision with PowerupCalibre... Call Function "WeaponLeveling" (CalibreEXP, CalibreLVL)

    On Collision with PowerupSpread... Call Function "WeaponLeveling" (SpreadEXP, SpreadLVL)

    My problem here is how to reference the respective original variables (as defined by the instance variables plugged into each Function call). Even if I use Ship.UID with the Function, I'm left confused on how to single out and plug in the right values back to the right variables without creating more sub-events/actions within the Function which is the entire point of creating the Function in the first place (to be able to reuse the same events with a single call and just swapping out variable references).

    If I can only use the one action - ReturnValue - then I'm left with what seems no recourse but to make specific references to each of the 8 variables in question...which, again, is what the parameters are for, so I thought. I'm ultimately lost on the syntax...where do I PLACE this information? In the Function event, itself? In the Function call event line?

    I really just need someone to spell it out for me because I'm not seeing it...

    Thanks again for the help.

  • Thank you, I'll see if that clicked in my head as well as I believe it did.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • blackhornet - I think I understand.

    So I would use Function.ReturnValue or Function.Call immediately AFTER the "Set Return Value..." to ensure that the instance variable associated with that parameter in that action line gets properly set?

  • I think I've got a good chunk of Functions figured out, but I'm having trouble working out how to pull the values from the parameters and plug them back into the instance variables they initially reference.

    I have four different variables which are all checked in the same way to make sure they stay within bounds.

    When a power-up is collected, the EXP variable is increased. When it reaches 100+, the LVL variable goes up by 1 and the EXP variable is reset to the [amount]-100. And, the LVL can't go higher than 4. (I forgot to add a check when the EXP is greater than 100 at LVL 4...I'll fix that later.)

    As I understand it so far, the Function action "Set Return Value" does just that: sets the Return Value for that parameter. But I see that there is also a Return expression, and I believe that is how I would pull up the value that was set by "Set Return Value". However, I am unsure where to plug it in at - in the Function instructions or after the Function call?

    This way, whether it's the speed, the fire rate, etc, that gets put into each of the two parameters upon the call to the Function, each instance variable is updated as if I created four sets of identical events for each variable (which...is rather what Functions help with, so...duh lol).

    Thanks for the help!

  • Tetriser - I have not. I've been very busy with work and personal life stuff. I'll try to give it a look later on.

  • zenox98 - GOT IT! Thank you! That is SUCH a lifesaver! I'm back in business!

    Nearly seven whole days of work was lost (well...not totally true...I also save different files as I make progress, so I basically create my own "backups", too).

  • I do! I do!!! Please, oh dear God in heaven (I mean that sincerely, LOL, I'm a Christian).....do tell me how do I recover the files with the autosave/backup?????

  • Problem Description

    I downloaded beta release 204 (April 27). Then, when trying to open a .capx file I saved (while using beta release 203), it gave me the following errors:

    [quote:drhawpbo]---------------------------

    Construct 2 Check failure - C2 Beta Release r203

    ---------------------------

    Check failure! This is probably a bug:

    cannot find animation frame either in last_path or project location

    Condition: FileExists(GetProjectPath().c_str())

    File: Projects\AnimationFrame.cpp

    Line: 239

    Function: class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __cdecl AnimationFrame::GetActivePath(void) const

    Build: release 203 (64-bit) checked

    Component: Construct 2 IDE

    (Last Win32 error: 3)

    Clicking RETRY (on the alert pop-up) yields the following:

    [quote:drhawpbo]---------------------------

    Error loading project

    ---------------------------

    Failed to open project '\\?\C:\Users\Rhindon\AppData\Local\Temp\capM6WHGK\Gradient Run.caproj':

    Cannot find object texture file 'ShipHit.png' in the project texture folder. Check the file has not been renamed or removed.

    Under element: c2project \ object-folder \ object-folder \ object-type

    Line 248, column 13

    The file may be invalid. Try checking the file in a text editor (projects are saved in XML format).

    Attach a Capx

    [link=https://db.tt/CIL79etD]https://db.tt/CIL79etD[/link]

    Description of Capx

    A beta release of my video game project as found here: [link=http://gamejolt.com/games/arcade/gradient-run/62998/]http://gamejolt.com/games/arcade/gradient-run/62998/[/link]

    Steps to Reproduce Bug

    Difficult to do...

    • Originally produced game on r203 and saved .capx file
    • Downloaded r204
    • Opened .capx and was given errors as described above
    • Reinstalled r203 and was given the very same errors
    • Reinstalled r204 and continued to get same errors

    Observed Result

    Errors as described above result.

    Expected Result

    Able to open .capx events and layouts to continue editing game.

    Affected Browsers

    • Chrome: N/A - cannot open file
    • FireFox: N/A - cannot open file
    • Internet Explorer: N/A - cannot open file

    Operating System and Service Pack

    Windows 7 Home Premium Service Pack 1

    Construct 2 Version ID

    Release 204 (64-bit)

  • Update for April 23-24 now up with an overview of the enemies.

  • I would definitley like to check this out. I'm at work but I'll try to remember to come back later and give my input.

  • Additional update for April 21-22!