On Start of Layout + Function Question

0 favourites
  • 11 posts
  • Hi,

    i got 2 questions:

    1. does the "on start of layout" condition need to be in an event sheet, that already got this condition?

    i tried to use this condition later again in another included event sheet, but then it's not working. (r114)

    2. based on the last question in this thread, i still could not find how to perform a function on simulatanous collision of multiple object instances with other objects. when using the "trigger once" condition to kick the turning function, only one instance of "enemy" turns around at a reverse point. all others "walk over".

    any help welcome <img src="smileys/smiley1.gif" border="0" align="middle">

  • 1- The event sheet should be assigned to the layout for it to work , and you need to take note that the "on start of layout" condition can only be triggered when the layout starts ( You can restart the layout ... )

    2- I Didn't use the functions until now , so I'm not sure ... You could join all the enemies in a family so it could affect all the instances of the enemies !

    Cheers

  • thanks for your reply whiteclaws.

    1. both event sheets are included by the one directly assigned to the layout. but the first "on start of layout" is in an "earlier include state" than the second one. anyway, the second one does not work. i did simply try to cut&paste the event into the event sheet with the first "on start of layout" condition, and there it works...in spite of being an own event.

    this is really strange, since the other events in the third sheet work fine...its only the "on start of layout"- one thats ignored in it.

    hope someone here understands what i mean <img src="smileys/smiley17.gif" border="0" align="middle" />

    2. the opposite is wanted, every enemy instance should be handled itself. but this does not seem to work with the "trigger once" condition.

  • 1. should work. It works for me in a simple test case. What are you trying to do on start of layout exactly?

    2. I gave the enemy a boolean var called 'turning'. When the enemy is overlapping or by a wall and turning is false, set turning true and call the turn function. When he moves away set turning false again.

    <img src="https://dl.dropbox.com/u/8367729/construct/pics/turning.png" border="0" />

  • ramones: it really should ^^. Please check the PM i'd send you with a link to the current file.

    2. that should do it, thanks. :) but i think such simple things are getting very complicated in c2. thought this should work without additional variables.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It only gets kind of complicated when you're comparing the four different turning conditions in the same event. You could have it like this instead:

    <img src="https://dl.dropbox.com/u/8367729/construct/pics/enemyChangeDirection2.png" border="0" />

  • 1. did you look into the actual file?

    2. Through the missing "trigger once" this does not work. Also i've tried your boolean instance solution, but it is just the same as before, the ki does not change only once. the problem is the function, not the condition calling it.

    i am amazed about such a simple thing not working in c2,

    any other ideas welcome <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Oops that should be enemy.UID not enemy.IID. Fixed the screenshot. I replied to you PM too.

  • About the start of layout issue, there's this rule to keep in mind:

    "Start of layout of included sheets always happen before the start of layout of the current event sheet even if it's placed after."

    For your other issue, I would need to see at least a screenshot of the conserned events.

  • Yann: thanks for this information; that is it! But why is this handled so?

    For the other event, I could (temp) fix it with the mentioned instance variable and without a function.

    Since the game is getting more and more complex, i think i will need the function again later.

    cya <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Never really understood why (:

    Anyway I only ever use inclusion when I really need the same piece of code in 2 (or more) different event sheet, which is pretty rare since either I use one layout/event sheet for the whole game, or I use the same event sheet on every gameplay layout

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)