crawly's Forum Posts

  • 7 posts
  • I would approach it like this:

    https://dl.dropboxusercontent.com/u/7871870/construct/family-trick-demo-02.capx

    Also depending on how your objects are setup it's better to compare the heights using a defined threshold, since sometimes they can be slightly different due to rounding errors.

    Sorry for late response. Had the wrong version installed, so I couldnt check out your solution.

    Anyways now I did, and it looks neat and fairly simple. Can't say I fully grasp it since I have yet to work with families, but as soon as I understand it i'll try to use your solution instead.

  • Heres a pic that might explain it better. Now I just wait for a nicer solution. :)

    <img src="http://i39.tinypic.com/2n00nkz.jpg" border="0" />

    I should mention that I initially thought I would have the need for the IID's, which is why I made some space for them in the controller object. Looks like I didnt need them, so you can ignore those lines.

  • Ok, I found a (not so) quick and dirty event based solution but i'm not sure it's the best one. Anyway - it works!

    I have my blue square objects which I named "R". I also made a controller object named "C", which is placed off screen. C have two instance variables named "first" and "second".

    * R - on collision with R

    *     System - Pick R instance 1 (make a sub-event, system and "pick nth instance"

    The action part of the sub-event is "C" set "first" to R.height (height of R gets stored in the "first" variable of "C")

    * Make another sub-event to the first collision event but this time pick instance "1" and store the height in the variable named "second".

    * Create yet another sub-event (from the collision event), choose "C" compare instance variables and check if "first" and "second" are equal.

    * Create two new sub-event from the comparison sub-event (so that it's a sub-sub-event when viewed from the initial event); choose "System" and pick nth instance again (first instance "0" and then instance "1"). Adjust their sizes accordingly (or whatever you want to do).

    It sure gets more complex to explain then it looks on the screen.

    You basically have the first collision event to catch the actual collision event. Underneath this one you use "pick nth" to store the height (or something else) in a controller object, for the two objects involved (0 and 1 for pick nth).

    Last you compare these figures, but put this comparison-event under the initial even to avoid it getting checked outside actual collisions.

    So it works. it's just a bit clumsy.

  • Ok, still not getting it...

    I got identical blue squares floating around in a random way. If two collides I want to check if they are the same size, and if they are increase both sizes by some amount. Different sized squares should merely bounce off eachother.

    What I want to do is (in a basic kind of way):

    If square collides with square

    AND

    self.height = other.height

    THEN

    self.height=self.height*1.1; self.width=self.width*1.1

    other.height=other.height*1.1; other.width=other.width*1.1

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have searched everywhere for a simple solution for this, and is actually quite surprised that it seems overlooked; or did I just miss that part of the manual?

    Self and other is a neat solution in several other systems, and perfect for standard collisions and so on.

    Edit: Thanks to the one that mentioned pick nth instance - scirra.com/manual/124/system-conditions

    Ill try this and see how it works.

  • This is just an example. I'll make some tiles that make walls and corners if I got some time tomorrow. Oh, and floortiles with shadows from walls.

    <img src="http://i46.tinypic.com/34h8ga1.png" border="0" />

  • I would love to help you out in your project. Most of all because I want to play the game :)

    How do you need the tiles to be organised? Walls fill out the entire 16x16 tile, or just on one side (like 8x16 and rotated)?

    What kind of tiles do you need for starters? One kind of floor and wall?

  • 7 posts