Yttermayn's Forum Posts

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

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

  • Try Construct 3

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

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

  • Thank you, I will check that FAQ.

    Another, minor thing: I cannot seem to make local variables. The manual says that they are created under events on the event sheet. Right clicking in the root (blank area) of the sheet gives the option to create a global, which works fine for me, but right clicking anywhere else give no options for variable creation. I am just wanting a couple local variables for number crunching in a function...

  • Ok, so if I had several instances of an object, and I ran a spawn object, each instance would spawn a new object. But using create object, I would get just the one straight from the system? That makes sense.

    Quote/

    As far as retreiving UIDs, you shoudl be able to do it like that:

    -> Create/Spawn object

    -> set variable to object.UID

    /quote

    So how do I reference the new instance I just created, instead of another that may already be in existence? IE, I'm randomly generating a solar system, with a random number of planets. My random number generator comes up with five, so five planets are created. A few ticks later, I may need to update each individual planet's orbital positions and other data. In other languages/utilities, the creating function would return a pointer, or the equivalent of each planet's instances UID that could be stored and referenced later to get at instance-specific data. That's what I'm after.

    This will become very important as I progress in my project, since there will be a great deal of procedural generation going on.

    Thank you for your help so far!

  • When using create object, how does one get the new instance's UID and IID back to store for later? Couldn't find any direct answer to this in manual or forums so far. Also, what is the difference between 'create object' and 'spawn object?'

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

  • Thanks Vee41, that made perfect sense!

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