Fistmaker's Forum Posts

  • I'm assigning behaviors via families.

    So, in order to disable a behavior, I'd have to put each sprite into every single family that I have, and then disable the behavior I don't want. Based on the scenario.

    I'm trying to prevent Sprites with 500 behaviors, and instead have a sprite with 20 Families of behaviors.

    This way I could add or remove complex behaviors to any sprite, regardless of it's current set.

    I'm trying to do Entity Component stuff, but it's hard to figure out how to do it in Construct 2.

    Doing it the other way around would mean that I'd have to make one sprite with EVERY behavior and disable them all at start up, and then turn them on conditionally. I think that would be a mess.

  • I have multiple families set up.

    I have my sprites part of multiple families, but I'm wondering if it's possible to add or remove the sprite from a family during run time.

    I've been looking all over the forums and the site, and I check the FAQ page and didn't find anything on it.

    Is it possible to change families during play?

    For an example, each of my families has specific functions. Named, AstarMovement etc...

    I might want to spawn a named tree that moves. So to do this, the tree must belong to both named and AstarMovement families. But if I want to change a tree that was just spawned with just Named to be able to move, I have to delete the first tree and replace it with one that's in both families. (I hope I'm explaining this right...)

    Is it possible to add or remove sprites from a family during play/runtime?

  • After some Trial and error, I have been able to get a dictionary to store the data correctly.

    Keyboard: On key pressed:

    -+System: For each TerrainTile: Dictionary: Add Key"Tile"&TerrainTile.UID with value TerrainTile.AnimationFrame

    I tried this same method with Arrays with no success. I'm not sure why it won't work, but I guess I'll move on to using dictionaries barring one more thing.

    I am able to download the data.json file, but how do I go about loading it? I've looked at the project files tutorial, but I don't see an example on how to load the saved dictionary. Can someone point me on how to load a .json file to a dictionary with a project file?

    I'm not interested in keeping the file in webstorage.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you give me an example that uses dictionaries instead?

  • I have looked at your tutorial before posting, but as you state at the beginning of your tutorial, it is not for absolute beginners. It seems that when it comes to arrays in C2, I am an absolute beginner.

    I know in other languages, I would:

    //Loop

    For X in Width:

    For Y in Height:

    Array[X,Y] = Tile.Frame

    //End Loop

    But I cannot seem to figure out how to do this properly in C2.

    My array is always full of 0's.

  • I've been reading the tutorials on arrays, and have looked at the FAQ about arrays, but I still seem to be missing how they work in Construct 2. I am trying to save a list of animation frames to an array and download it via JSON but have had no success.

    In this example, I am painting terrain (hold SPACE and left click on the terrain you want to paint in the menu, then just left click on the map) and I want to save it with the "`" key, and download it by pressing TAB. This is just a test for something later, but I can't seem to get the saving part right. I'm not sure how Construct iterates over an array.

    Example capx: Capx

    Any help will be greatly appreciated.

  • Have you looked up using a seeded random? You can use a seeded random to get the same result every time, without having to save any data. So, if persistence isn't an issue, you can either have spawned tiles or pre-generated ones always give the same outcome. I'm sure that I've used a plugin for this in the past. It was either RGen or Random Plus.

  • It looks like you are using a Spline Plugin. I haven't used that, so I couldn't tell you if what you posted would work or not. I'd check with the author of the plugin just to be sure.

  • If you want to spawn an object on Point instance one, on a new event line:

    Pick nth instance: and choose Point, then 1.

    Then have Point spawn another object "Line" at Point.x/Point.y

    To point the newly created line at the next instance, align "Line" to Point(2).X/Point(2).Y <-- (it's actually typed this way) Check the UID/IID example for a more detailed explanation! Good luck!

  • You could use UID (Unique ID) or IID (Instance ID) to specify which point is next. So, as you create points along your path, the first one would be Point(0), the second would be Point(1) etc.. You could have Point(0) spawn a line and point your line sprite to Point(1).X / Point(1).Y

    There are some good tutorials about the use of UID and IID. Also, the manual explains them pretty good too. They are very helpful.

  • Well, I'd say the easiest way is to give your Line Sprite the bullet behavior and point it at the next point in line. Then have it spawn another point while it is moving along it's path. Destroy the Line when it hits the next Point. This will "Draw" points along the lines path. Now, it wont be "smooth", but it will connect your dots.

  • Now, I'm not sure if this is the best way to do this, but this is one way to accomplish this with 4 events and one family. The idea is to not move the ship at all, just correct it's angle north, and have everything else move around it. Here is a Capx.

    dl.dropbox.com/u/11063814/Rotating%20Space.capx

    Hope that works for ya.

  • This is exactly what I needed. Thanks! Man do I need to brush up on my math stuff. Wonderful solution.

  • Yeah, you can Pin another sprite to the Object's Image Point and then check for collision of the attached sprite. You can make it invisible if you need to.

  • Howdy again all!

    I'm looking for another solution for an issue I am trying to work out.

    What I want to do is spawn a sprite over another sprite at random. Currently I have created Image points to use as a marker for where things can spawn. Using Image Points 1 thru 5 on one sprite I use Choose(1,2,3,4,5) to spawn one at random on one of the five points. While this works great, I'd like to spawn another sprite over ANY X,Y point of the first sprite without having to create lots of Image Points.

    Is there a way to spawn an object over any x/y coordinate of a sprite? I'd like it to spawn anywhere on the base sprite inside of it's collision mask. Any ideas?

    It seems that I cannot post a direct link as I don't have enough points.

    dl.dropbox.com/u/11063814/SpawnOverSprite.capx