Nilom's Forum Posts

  • Hello there!

    I have multiple different interactive objects which overlap each other.

    I know how to pick the top most of an object. And I know how to put these objects into a family and pick the top most of this family. But my problem now is that each of these different objects have different things to happen if clicked/tapped.

    So how can I do something like this:

    If object touched "InteractiveFamily" {
    	Pick top "InteractiveFamily" {
     		If object touched "objectA" {
    			..things to happen..
    		}
     		If object touched "objectB" {
    			..things to happen..
    		}
     		If object touched "objectC" {
    			..things to happen..
    		}
    	}
    }	
    

    How can I pick the top most of different objects and then check which of these is picked?

    Thank you in advance!

  • I would not use drag & drop behavior for that. When touched, just set the "angle toward position" -> touch.x & touch.y.

  • My first attempt in doing that would be to spawn a hidden object on the enemy if you cast your trail skill. Let it face the players direction in every step. Then check if its angle changed from the base angle to +360° (if it circled itself one time).

    But there might be better ways to do that. But you could give it a try as a first solution.

  • Hello there!

    I have some questions about performance.

    1) Am I right that it will result in a better performance if I let the player object check if it is colliding with one of the hundreds of trees in my game instead of letting hundreds of trees check if they collide with the player object?

    2) For the tree falling animation I use the spin behavior and check if the tree is 1° to 90°, if so change it to a laying tree object so it will stop spinning. Am I right that it will have a better performance if I swap this tree to another unique tree object before the spinning part so that the eventing will only need to check trees that are actually falling instead of also checking all the hundreds of other trees degrees that are not currently effected from chopping? Or is it more demanding to destroy an object and let another spawn on its position?

    3) I use player to tree collision checking to make the tree 50% opaque if the player is behind. For setting the tree back to 100% opacity I use "on every 0.2 seconds -> tree set opacity 100%". But this affects every tree. Is there a more elegant way to achieve this?

    4) If I set an object to anothers child, it has better performance if I unselect as many of the "child-syncing" options as I can, right? Or do these only really take up performance if their parents are moving or changing their angles?

    Thank you in advance!

  • Thank you! After some testing after my post I got it to work. I guess it was too late to have good ideas. Now I even used timers and got it to work. :)

  • Hello!

    For the interface of my game I want to use the tween behaviour. If the user mouse-overs the interface preview it will tween up. Then he can press buttons inside what came up. When the mouse leaves this area the interface should tween down again.

    How can I detect "on mouse leave"? I tried using a boolean true on mouse-over and setting it to false every tick. But when not mouse-overing that results in the interface permanently tweening down till abyss.

    Any better solutions? Thanks! :D

  • I could indeed just cover the parts with blocks. That would have way less impact on the performance, I guess. But I would need a way to check the background color on runtime. Is there a way to do so?

    Thanks for the demo. I need to learn more about these blend modes.

  • Hello there!

    I'm still figuring out how to make a proper slide menu. Currently I'm trying to find the best way to only show a small area from all the objects of the slide menu.

    The rectangle is the visible area of the slide menu. Inside this rectangle the overlapping (blue) parts of the circles should be visible. The circles are the individual menu objects.

    Every (red) part of the circles who are not inside this rectangle should be hidden.

    I tried to achieve this by just using a sprite with the same color as the background which is placed on top and bottom of the rectangle area. So this sprite just overlaps the parts of the circles that should be hidden with the backgrounds color. The problem is that I do not know how I can set this "HideArea"-Objects color the same as the backgrounds color. How can I check the background color in runtime?

    Or is there a more elegant way to achieve this? Like make a sprite invisible and just make the rectangle overlapping part of it visible?

    Note: There are other objects outside the rectangle that must still be visible.

    Thanks in advance! :)

  • I need each of these buttons to be slideable. The day, month, year etc. .

    The problem I have with the family system inside the editor is that this way I would need to make one separate object for each button and can not use my ButtonCreation function.

    That's a pity that it can not be changed in runtime.

    Edit: Thanks for the demo though. It helped me with another problem. :D

  • Hello!

    Is it possible to add objects to families from within events?

    I'm trying to create sliding menus. Like for selecting your birth date etc. .

    And I found dop2000's example here: https://www.construct.net/en/forum/construct-2/how-do-i-18/swipeslide-transition-menu-132684. He uses a family for the button movement. But for creating the buttons I use a function and it would be great if I could assign these inside the function to the right family.

    Or alternatively does somebody know other ways to achieve this?

    Basically what I'm trying to do is exactly this:

  • Thank you for both of your suggestions. I'm sure these will come in handy in the future. For now I will just use separate text objects for regular text and for button text.

    Stupid me was too fast with posting before thinking. But now I know two alternative solutions for future problems. :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just trying to delete all text with the exception of button text. But I guess I will just use other text objects for button text then. Might also have better performance than checking collisions etc. .

  • Hello!

    I use 9patch objects for my buttons. How can I check the collision between text objects and 9patch objects as both do not have "on collision with another object"-events?

  • Okay I see the problem now. It is way more complicated than I thought. The same goes for italic font. Some letters will be cut off at the end.

    So I guess it is never a good idea to set the text objects size exactly to the text size.

    Perhaps instead of guessing I could use some sort of percentage "buffer zone" around the text. That way it would be scalable.

    For now I will use something like

    Text: Set size to (Self.TextWidth+Self.TextWidth÷10, Self.TextHeight+Self.TextHeight÷10)

    which will make the actual size 10% larger.

    Thanks Ashley for the explanation!

  • I was facing the same problem.

    What did the trick for me was to place a TextInput object in the editors layout and to untick "Auto font size". You can place it off-screen and delete it on startup. The following TextInput objects that you spawn will keep the settings.