locohost's Recent Forum Activity

  • Calculating paths for sprites produces a pretty big delay and causes scrolling to pause and jitter. Can I, during game load, calculate a bunch of paths, store the paths, then use them later to move sprites?

  • Yep, working well. Adding an Array as a contained object in the Person sprite is the answer. Thank you, thank you, thank you guys!

  • Ahhh Ok then! Thanks guys!

  • +1 for Container, it's exactly what you want. Even if you didn't have Containers, you could just store an ID or UID to index into a separate array per sprite instance.

    I don't see any way to reference a contained child object from the parent container so I'm not sure how "Container, it's exactly what I want"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • +1 for Container, it's exactly what you want. Even if you didn't have Containers, you could just store an ID or UID to index into a separate array per sprite instance.

    This is what I'm working on

  • > You can use a Container to attach an Array to a Sprite.

    >

    Interesting. Didn't think of that. Let me see what this can do...

    Containers allow objects to be grouped together and then act as one object when creating and destroying. The Container does not provide a way to easily/directly reference child objects.

    What we really need is to be able to add an Array as an instance variable in a Sprite. But we can't do this so I'm trying to figure out some way to hack this together.

  • You can use a Container to attach an Array to a Sprite.

    Interesting. Didn't think of that. Let me see what this can do...

  • > Use a string and split it into an array?

    >

    Yeah I had that thought too, but it would be tough to manipulate (add/edit) the data in each "cell" during runtime.

    I'm working on an idea which prompts a related question: When I use System.CreateObject, how can I catch the newly created objects UID? My thought is in the Person.onCreate, I create and Array object, catch the UID and store that in the Person in an instance variable. Now I can keep an array of data for every Person instance and find it quickly.

    This seems hacktastic but perhaps this is the only way: In Array.onCreate, store it's new UID in a global var. Now when I create the array in Person.onCreate, I can get the new Array.UID. Is there an easier/smarter way to do this?

  • Use a string and split it into an array?

    Yeah I had that thought too, but it would be tough to manipulate (add/edit) the data in each "cell" during runtime.

    I'm working on an idea which prompts a related question: When I use System.CreateObject, how can I catch the newly created objects UID? My thought is in the Person.onCreate, I create and Array object, catch the UID and store that in the Person in an instance variable. Now I can keep an array of data for every Person instance and find it quickly.

  • I need to store and array of path destinations as well as some other instance specific game data. Easily accomplished in plain Javascript, but since C2 instance variables can only be numbers or strings, how can we do this?

  • Ok I figured it out. I was setting the LOS behavior properties on just one instance of the many Person sprites. I had to set the Range and Obstacles in the Person onCreate event. It works fine now

  • Los is to a point only.

    The hotspot.

    Thanks for the reply, but that's not completely true. According to online C2 docs...

    The Line-of-sight (LOS) behavior allows the ability to check if two objects can "see" each other. More precisely, it will check if there are any obstacles blocking a line between the two objects.

    https://www.scirra.com/manual/163/line-of-sight

locohost's avatar

locohost

Member since 19 Sep, 2014

None one is following locohost yet!

Trophy Case

  • 10-Year Club
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

14/44
How to earn trophies