ramones's Forum Posts

  • Families and objects have separate picking. I mean if you have a condition that picks Enemies then you have to reference Enemies in your action.

    You can have

    +Enemies: Action = "Attack"
       -> Enemies: Set animation to "Attack"
    

    or

    +EnMelee: Action = "Attack"
       -> EnMelee: Set animation to "Attack"
    

    but not Enemies in the condition and EnMelee in the action.

    You've done it right in most places but not in events 6,7,8.

  • Setting text to a number rounds the number (to 5 decimal places) which is why it looks like it should be working. Set your text to str(TimeSpan) and you'll see what's happening.

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

  • 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" />

  • You should be checking if BABY_HAPPY = "1" since it's a text var not a number.

  • 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" />

  • Change 'Set Angle' to 'No' on the 8Dir behavior.

  • Sorry I meant adding it to the existing div (id="c2canvasdiv") not creating another div inside.

  • The only case it wouldn't pick the new object is if you have Sprite1: Spawn Sprite1.

  • The border seems to shift the canvas down and to the right. (Like you'd expect but I don't know why it affects the mouse position) What about adding the border to the div around the canvas instead of the canvas directly. That works and gives the same effect.

  • Here's one way: randomColors.capx (r113)

  • Duplicating the layout doesn't duplicate arrays because they are normally global objects. In that capx the AvailableDirections array is not global but if you change it to global it will work.

  • both point makes sense, thanks. <img src="smileys/smiley1.gif" border="0" align="middle" />

    For event 9, how can i leave the function instead of adding the else condition?

    Don't think you can.

    and for event 6, i guess a "wait" action should fix this too, right?

    Nope with wait you'd just be queueing up many function calls to happen after x seconds because the event is still going to run every tick.

    at least, do you know why the enemy UID kicks up this way?

    Not sure what you mean about the enemy UID. Every object has a different UID, every sprite, text object, etc. You have 55+ objects in your layout so it's not surprising that the enemy UID could be 55 or 56.

  • It's not a problem with UID, it's your events. Two things. When movementDirection = 2 then event 8 changes it to 1 and then event 9 changes it back to 2. So the enemy will turn right but never left. You need an else in there.

    The other problem is in event 6. When the enemy is overlapping the object or standing next to a wall the change direction function gets called repeatedly. Every tick you'll be switching directions until you move away. So you need a trigger once in there.

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sounds like you're looking at actions. The option for comparing booleans is a condition.

    For else, right-click the event and go to the 'Add' sub-menu and the last option is 'Add else'. Or the shortcut is select the event and press 'X'.

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