Mithrill's Recent Forum Activity

  • Asmodean

    Thank you so much! You helped me a lot ^^

    -M-

  • Hey there,

    I have a problem. This time, I’m trying to make a chain on start of layout.

    I’m using pin behaviour -template (which is included in C2) as a base. In this example, Blobs are already on layout and are pinned to each other on start of layout. Then, depending of their instance variable “number”, they are pinned to player or to each other. (I won’t cover that much details here, check my capx or example in C2 for more details)

    However, I need to create these blobs during run time on start of layout. This is where I’m having a problem. First I thought I can just replace “for each” with “repeat nn times” event and call it a day. I was wrong. I don’t understand what I’m doing wrong here.

    Remove those *** from https: to download.

    h*t*t*p*s://dl.dropboxusercontent.com/u/43020976/Scirra%20forums/pin%20to%20family/pin_to_family_example_r233.capx

    Any kind of help is highly appreciated.

    -M-

  • Thank you everyone for charing your tips :)

    Daggio,@Bro7hers, looks like my research about events sheets failed me :/ I had completely forgot about those trigger events and how they are executed.

    Kyatric, this function method sounds like a good option. Currently I really need to find a way to optimise my events.

    Cassianno, yes, I did mean event groups so my bad -_- About your tip, personally I don't want to separate my events into many event sheets. Too much hassle and to me it's hard to keep track of what is where. This is completely personal opinion of course :) I like to use groups instead.

    Another question rise from back of my head: I'm using same group structure as in my first post. Lets pretend that I have a boolean variable called "isActive" in group Enemy/AI.

    Just for demonstration,

    distance: player, enemy less than 50 > set enemy.isActive = true

    when that boolean variable "isActive" is true > set enemy angle to player.X/Y.

    else

    distance: player, enemy greater than 50 > set enemy.isActive = false

    Boolean variable "isActive" is false > set enemy angle to self.X/Y.

    What are the benefits if I disable that Enemy/AI group when boolean "isActive" = false? Because I don't see any reason for C2 to check those events in that group if Boolean isn't true in the first place.

    I was thinking something like this:

    distance: player, enemy less than 50 > set group Enemy/AI > enabled and set enemy.isActive = true

    Boolean variable "isActive" is true > set enemy angle to player.X/Y.

    else

    distance: player, enemy greater than 50 > set enemy.isActive = false

    Boolean variable "isActive" is false > set enemy angle to self.X/Y, and set group Enemy/AI > disabled.

    really quick and dirty example and I hope everyone will understand :)

    What I understand about C2, is that it will check events in every event groups which are active (obviously). If I have that 3000+ events, I think it's not really beneficial to check events from every group if those events aren't used. Using that example above: if group Enemy/AI is active, C2 will check that group and that boolean. Then C2 will run the events depending of the boolean state. BUT if that group is disabled, then C2 will skip it and theoretically save some recourses.

    If I'm completely wrong, please correct me. I really want to understand how to optimise events and how C2 is handling things.

    -M-

  • Hey everybody,

    Now I have this question floating in my mind. How to optimise events. In C2 events are read from top to bottom. Yes, I did my research ;)

    What is the impact to performance and/or efficient if events aren’t in an optimised order?

    Example:

    Let’s say I have 3500 events and I have organised them by folders. All player events are in the folder called “Player”, all enemy events are in “Enemy” and so forth.

      “Player” root folder
        “initialisation” subfolder “controls” subfolder “animations subfolder
      “Enemy” root folder
        “initialisation” subfolder “AI” subfolder “animations subfolder
      “Enviroments” root folder
        “trees” subfolder “animals” subfolder

    Next, on start of layout I want to create player object.

      “Player” root folder
        “initialisation” subfolder on start of layout: create “player” sprite object at X/Y. “controls” subfolder “animations subfolder
      “Enemy” root folder
        “initialisation” subfolder “AI” subfolder “animations subfolder
      “Enviroments” root folder
        “trees” subfolder “animals” subfolder

    Then I want to create some enemies and some trees, also on start of layout:

      “Player” root folder
        “initialisation” subfolder start of layout: create “player” sprite object at X/Y. “controls” subfolder “animations subfolder
      “Enemy” root folder
        “initialisation” subfolder on start of layout: create “enemy” sprite object at X/Y. “AI” subfolder “animations subfolder
      “Enviroments” root folder
        “trees” subfolder on start of layout: create “tree” sprite object at X/Y. “animals” subfolder

    Question: in this example, are all those on start of layout -events fired on start of layout, even though some of them are very bottom in events order? To me the answer is yes but could there be an issue of some kind if there are 3000+ events between the first on start of layout -event and the second? Should I do something like this instead:

      “Root” folder
        “initialisation” root folder on start of layout: create “player” sprite object at X/Y. on start of layout: create “enemy” sprite object at X/Y. on start of layout: create “tree” sprite object at X/Y.
      “Player” root folder
        “initialisation” subfolder “controls” subfolder “animations subfolder
      “Enemy” root folder
        “initialisation” subfolder “AI” subfolder “animations subfolder
      “Enviroments” root folder
        “trees” subfolder “animals” subfolder

    Personally I don’t want to use this method because I really want to organise my events by putting every player related stuff in “Player” folder and so on. BUT if there indeed are some performance issue or similar thing, then I guess I have no way around but to do like I described above.

    If someone has a tip or two to offer, feel free to do so ^^

    -M-

  • Conclusion: boolean variable isn't applied to containers. That is good to know.

    , thank you very much for your answers AND patience. I Just read my previous posts and I realised that the way I described everything wasn't very clear. Sorry for confusion I caused to you.

    I will improve the way I describe things in the future

    -M-

  • I just deleted all of your logic and put in one line : Player is overlapping door_opener > set door animation "open", it picks the door that is in the container with the door opener you are overlapping. If you overlap two door_openers then it opens the doors in both. Seems to work fine.

    , yes, opening door indeed works. That isn't the problem. Problem is closing. Other "Door" won’t close if player is overlapping with "Door_Opener AND there is also another "Door_Opener" overlapping that same "Door_Opener".

    Problem:

    h*t*t*p*s://dl.dropboxusercontent.com/u/43020976/Doors%20and%20container/Door%20screenshots/not%20working%20both%20opened.png

    Like I wrote in my initial post, I know how to fix this, I just want know why boolean variable "isLocket" isn't enough to pick each individual "Door" and "Door_Opener" object. I want to learn this because then I have a knowledge (or at least a hunch) of what might cause the problem or if I ran into a similar situation in future projects.

    -M-

  • I'm also experiencing this same problem. Guess I need to Switch from Dropbox to external HDD.

    -M-

  • , Sorry if I confused you. That was not intentional.

    Each sprite object called "Door" has another sprite object called "Door_Opener" added as a container. This "Door_Opener" will serve as a trigger to open correct "Door".

    What I want to happen:

    1) Sprite object "Door" boolen variable "isLocket" = false,

    2) when player is overlapping sprite object "Door_Opener",

    3) check which "Door" sprite object is container of this "Door_Opener" object and pick correct "Door",

    4) Open that "Door".

    Quote from Scirra manual: "If a condition picks one object in a container, every other associated object in its container is also picked." and "Adding them both to a container then allows events to treat both objects as if they were one, because they are always picked together."

    My question is: why boolean variable "isLocket" is not enough to filter out correct "Door"? I need for each: "Door" -loop to do that. Because "Door_Opener" is added as a container to "Door", I thought boolean variable "isLocket" will pick each individual "Door" AND "Door_Opener" sprite objects (because of the container -thingy).

    -M-

  • >

    > Problem is that the other door's won’t close if player is overlapping with multiple Door_Opener’s.

    >

    It does work, you just have the initial bool set to true on that left door.

    But player character isn't overlapping left door's Door_Opener container? Like in even sheets are conditions: Door.isLocket = false and Hitbox is overlapping Door_Opener and animation "closed" is playing>>> open door else Hitbox is NOT overlapping Door_Opener and animation "opened" is playing >>> close door.

    So why that other Door_Opener is also picked? I understand what you said about boolean variable but that Door_Opener is a container of that left door so it should not be picket because player is not overlapping it. Clearly I'm missing something here :/

    -M-

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 99Instances2Go , just remove those *** between h*t*t*p*s and you are good to go

  • Hey everybody,

    Yet again there is something bothering me. This time it’s doors. I included a sample capx so everybody can check what I try to describe here :)

    How everything will work:

    Each door has boolean variable isLocket. This needs to be false for player to be able to open a door. Door_Opener sprite object is added as a container. This will serve as a trigger. When player overlaps with this object and Door is not locket (boolean variable isLocket = false), correct door will open. There is also a condition that a proper animation of the door is playing before door can be opened. Then, when player isn’t overlapping Door_Opener, correct door will close.

    Here is couple of screenshots to give you a perspective.

    Picture1:

    h*t*t*p*s://dl.dropboxusercontent.com/u/43020976/Doors%20and%20container/Door%20screenshots/working%20both%20opened.png

    Picture2:

    h*t*t*p*s://dl.dropboxusercontent.com/u/43020976/Doors%20and%20container/Door%20screenshots/working%20one%20opened.png

    Problem is that the other door's won’t close if player is overlapping with multiple Door_Opener’s.

    Picture3:

    h*t*t*p*s://dl.dropboxusercontent.com/u/43020976/Doors%20and%20container/Door%20screenshots/not%20working%20both%20opened.png

    I did found out how to correct this. Just needed to add “for each: Door” -condition and then everything will work properly. Sample capx contains 2 door groups. Enable/disable to switch between working and not working events.

    My question is though: why I need to add that “for each” condition? I though that boolean variable (isLocket) will pick each object separately (and also Door_Opener's because they are containers of Door ohject's).

    Or clearly there is something I don’t know about containers and how they behave :)

    Sample capx: h*t*t*p*s://dl.dropboxusercontent.com/u/43020976/Doors%20and%20container/Open_door_with_container_r233.capx

    -M-

  • Option 2 - Create imagepoints where your collision polygon vertices are. You can refer to these imagepoints' positions, and get the difference between two of them to calculate a width and a height value.

    Yes, That could indeed do the trick. Thank you

    -M-

Mithrill's avatar

Mithrill

Member since 17 Jul, 2014

None one is following Mithrill yet!

Connect with Mithrill

Trophy Case

  • 10-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies