Yttermayn's Recent Forum Activity

  • In the example, it is redundant, yes. However, I'm just trying to figure out the proper syntax for use in expressions. So is that the proper syntax for referring to a particular instances variables via UID?

    Edit: Apparently not, I just tried it. How would you make that set text action work the way I intended? From within the "set text to" expression?

    Edit: It works if I use the IID in parenthesis. Cool. Still would like to know how to use the UID in expressions though.

  • So I could go sprite.iid.X or sprite.uid.X? to get the X position for a given instance?

  • I came across this problem while trying to reference instanced objects variables using the object's UID. I isolated my problems down to some unexpected behavior in C2. Not sure if it's a bug, or if I'm doing something wrong when I reference the variable.

    In the example, I have some instances of my sprite, some placed ahead of time in the layout, some created at run time. The original is at 0,0. When you click on them, the text box displays information about that sprite. First it's X position, then it's X position as referenced by it's own UID. Lastly it displays the sprite's UID. When you start clicking on different instances, you see that they seemingly randomly retrieve another instance's X position instead of it's own.

    What is going on? Is it a bug, or have I done something wrong?

    dropbox.com/s/t2o3doebf1x8yyb/bugtest.capx

  • From experimentation, it would seem that anchored objects are not moved to their anchored position until after the events in an "On start of layout" trigger.

    Is this correct? I have been working on a minimap with the MM field anchored, and calculating the offset would come out wrong if the calcs were done in the "start of layout" trigger, but they'd come out right if done anytime after that. I ended up making a combination trigger of "every tick" plus a do-once condition to make it work.

    I would just like to confirm the theory and make sure I am not making an assumption that will mess me up later.

  • The tutorial you pointed out is making a minimap from scratch, using a technique I pretty much figured out for myself already. I was curious about a minimap object that people on the forums were talking about.

    scirra.com/forum/minimap-obj-help_topic41394.html

    After re-reading this thread, I realized they are talking about construct classic. I don't suppose that C2 has such an object coming soon?

  • Looking through the manual reveals nothing. Forum search has people talking about ways to create minimaps from scratch, and about a 'minimap object'. While I can figure out how to make one from scratch, I'd much prefer to use any built-in functionality first. Can anyone clear this subject up for me? I see no minimap object in C2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thankyou! That's perfect. I had done it the second way, but I knew it should be able to do it inline.

    Thanks a bunch.

  • What is the correct syntax for calling a function from within an expression when that function is being passed parameters?

    I tried:

    Functions.Call("Srand(20,90)")

    where Srand is my function name, I am passing the minimum and maximum value of the seeded random number to be returned, and I do have the "Set return value to" event set correctly. I only ever get zero though, and no other variation in syntax gets passed C2's error detector.

    I know my return value statement is good because the function works perfectly when I get my return value with a separate Functions.ReturnValue event just after the call function event.

    Thanks.

  • Ok, figured it out. Had to add a blank sub event, then move my globals onto it to make them local, then make my actions under that.

  • By looking at examples, I can see that the authors somehow got their local variables to appear above the events that use them within the same scope, but I am not able to move them or otherwise coax them to do the same on my event sheet. It's like trying to unwrap a stick of butter with socks on your hands! (don't ask)

  • Hmmm, more problems. I've made my variables I intend to use inside my function local by dragging them into the area just below the part in the event sheet that has my function object name followed by the function's name in quotes. On my screen its a blank, light purple colored area. This made the variables local and they would seem to be part of the function. When I try to calculate something using them in a system->set (variable) to blahblah event, C2 tells me that my local variables(whichever one it encounters first) are an unknown expression in this scope.

  • Hey, that's slick! Thanks! Why isn't that in the manual under variables???

Yttermayn's avatar

Yttermayn

Member since 3 Feb, 2013

None one is following Yttermayn yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies