Rhindon's Recent Forum Activity

  • Got it. Thanks, everyone. I'll give that a go.

  • LittleStain - That's what I had in mind, but that would be a ton of event lines, which is what I'm trying to avoid.

    RayKi - I'm not sure I'm totally following how that will work. Could you explain the logic flow, please?

    Thank you both for your input!

  • For my game, I had my artist send me 70+ frames of a 3D-drawn spaceship (think Donkey Kong Country or Super Mario RPG in terms of 3D graphics in a 2D environment). I wanted to capture as realistic shading/lighting as could be and I wanted to utilize her unique skills as a 3D modeler. (I say this because I know someone is going to ask why I don't just use a single image and rotate it like normal. This is why.)

    I'm pinning this object with the 70+ frames to another object that will actually do all the movement and rotate as normal using the Rotate Clockwise/Counter-Clockwise actions. The angle of this object, which I call ShipBase, will determine which frame comes into play with the ShipImage object that the players will see. For instance, if the ShipBase is between angle -3 and +3, then the ShipImage will be frame 54 (which has the ship facing to the right).

    As ShipBase rotates ±5 degrees, the frame of ShipImage will update to reflect the new angle range. This will not be a problem to do as I can set up two variables to calculate the Current Angle versus the Past Angle and track the overall value in the delta of the angle. However, the problem I will face is when the angle rotates "below zero". If the Current Angle is 1 and then rotates below zero, then C2 will consider the updated angle is 359 or less. When I compare the difference between Current Angle and Past Angle, this will result in a value far greater than 5 and throw off my pending system to determine when to update the frame for ShipImage. Since C2 does not actually return negative-value angles (though it can calculate them), is there any way to account for the change from positive-value angles to negative-value angles via a counter-clockwise rotation?

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

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

Rhindon's avatar

Rhindon

Early Adopter

Member since 8 Jan, 2013

Twitter
Rhindon has 2 followers

Connect with Rhindon

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies