maxnichols's Recent Forum Activity

  • Ok, here's my situation: I am making a top-down, grid-based sand castle game. The game terrain is comprised of a few hundred "sandTerrain" objects, each one of which is a tile on the grid. Each tile has a "height" value of 1 to 4, which is represented by the coloration of the tile.

    I'm giving players the ability to either add height to the sand, or lower the height. They can hold down and drag the mouse button across the terrain to edit a line of sand. I am running into two problems with this:

    1. If the player moves the mouse really fast, some squares on the grid are skipped, and instead of a full line of edited squares I have a dotted line. Which makes sense; the mouse is moving faster than the code is checking. I suspect that I'll need to learn about fast loops and use those to do this, but any other thoughts or techniques would be very appreciated.

    2. Second, if the player is moving the mouse anywhere below max speed, the mouse hovers over an individual square long enough for the code to check at least twice, usually three or four times. This means that a piece of terrain at height 4 can be lowered down to height 1 faster than the eye can follow. Ideally, each single piece of terrain can only be raised or lowered once per mouse click. In order to make another change, the player would need to let go of the button they're holding, and then click again.

    I am unsure of a good way to fix the second problem, so any advice would definitely be appreciated.

    You can download a stripped-down version of my .cap file here:

    http://www.mediafire.com/?yv3rhozqzrw

    I am using Construct version 0.99.42

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, so here's my situation. I have these "wave" objects, representing ocean waves. They have the private variables MomentumUp, MomentumDown, MomentumRight, and MomentumLeft. Amogn others, but those are the relevant ones.

    I want to set it up so that if two of these waves collide (overlap, in this case; it's grid-based), they combine into one. I need to do things like add their MomentumDown variables together, or use their opposing momentums - left and right - to cancel each other out.

    What I need, in pseudocode:

    -WaveA and WaveB collide.

    -Spawn CombinedWave.

    -CombinedWave Momentum = WaveAMomentum+WaveBMomentum

    The problem I'm running into is that, since all three of these objects - WaveA, WaveB, and CombinedWave - are instances of the same class, I have no idea how to differentiate between their variables within the same equation. I know how to do it normally through manipulation of the SOL, but in this case I'd need to differentiate between at least WaveA and WaveB within the same equation, and the techniques I understand are not possible.

    I can think of a way around this, involving saving these PVs in proxy variables that I CAN distinguish between, but the end result would be extremely convoluted and messy, and I'm sure there is a better way. I've read all of the documentation I can find on this subject, and searched the forums, but no luck for solving a circumstance like this.

    I would really appreciate any advice. Thanks in advance!

    EDIT: And if I somehow missed nice documentation on this very subject, then definitely link me to it! I feel like this must be something that people have run into before, and I'm likely just missing existing resources explaining it.

  • Just realized I forgot to actually thank you!

    Yes, this information definitely helped me work that out. Thanks a lot, Davio.

  • First things first, I'm fairly sure that the answers to my questions can probably be found somewhere in the forums, a tutorial, or the wiki, but my best efforts haven't turned up anything. But I won't be offended if an answer is a link to a resource, hah.

    Here's my problem: I have an object with a lot of private variables that I'm tracking. I want to spawn different instances of this object, and I want to control what the values of those PVs are for each individual instance as it spawns.

    Example: Let's say I've got a "wave object" with the private variables speed, momentum, and volume. When this wave collides with a rock, I want to spawn a second wave with all of the same properties and whatnot, but with different speed, momentum, and volume values.

    My second question is more general: Where can I learn more about how Construct handles referencing instances of the same object? How does it know which instance I'm referring to when I have an event that does something to an instance of an object? Is there a way that I can grab a value from a specific instance without grabbing from the others? Etc. I basically just want to educate myself in this area a bit more, because I'm instancing a lot of objects and I anticipate having more questions.

    Thanks in advance!

maxnichols's avatar

maxnichols

Member since 26 Sep, 2009

None one is following maxnichols yet!

Trophy Case

  • 15-Year Club

Progress

15/44
How to earn trophies