Yttermayn's Recent Forum Activity

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

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

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

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

  • Matt75: How do you 'pin' an object to another object?

  • I figured out how to do this using the circle plot formula.

    NewX = OrbitDistance * cos(DegreesAngle) + OrbitCenterX

    and

    NewY = OrbitDistance * sin(DegreesAngle) + OrbitCenterY

    Where NewX and NewY are the X,Y coordinates of where your ship is going to be, DegreesAngle is what angle off of the space station you're calculating for, and OrbitCenterX and OrbitCenterY are the center coordinates of your space station, aka. the thing your ship is orbiting.

    If you keep incrementing DegreesAngle every tick, and assigning your shiup objects X and Y position to NewX and NewY, it will orbit in a circle around the space station at a range (radius) of OrbitDistance.

    Playing with how much DegreesAngle is incremented will adjust the speed, and you can even decrement it into the negatives to reverse the direction or orbit.

    You should probably put in a conditional statement that makes DegreesAngle wrap around from 360 to 0 or vise-versa depending on the direction of orbit. Otherwise, when the variable you are storing DegreesAngle in reaches its maximum value and wraps around, the ship will 'jump' to a different position in it's orbit suddenly. This might never come up depending on what size variables C2 uses. I don't know, I'm still learning the system.

    Anyways, here is an example from something I'm working on.

    dl.dropbox.com/u/142115313/SimpleSpace/index.html

  • Great, you're awesome, and thank you.

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