Asmodean's Forum Posts

  • .

    The problem seems to arise because the clicked state does not override the hover state (if you can click the image, your cursor is definitely over the object). So hover state is always active in these 2 states. If I do not use the hover state, then I can get the idle and click states working together.

    It's the other way around. All events are in one big game-loop and if you click your image the state will be immidetly in the next tick overridden by you hover-event. The click-event triggers but you don' see it.

    Put a 'trigger once' to your 'cursor is over'-event. But be careful you have to put it under your 'cursor is over'-event (not a subevent) otherwise you only trigger once the animation setting to 1 not the hover-event.

  • I think I understood your problem now. You want that if you overlap with the first result box, that the next result box reveal the result too. In the moment it works only if you spawn the boxes in real time during the game, but if you put the (result)boxes all in the layout in places, all boxes at once will show (spawn) the result. It's that correct?

    I've made a capx and I hope that is what you want. It uses the pick nearest condition, so you have to be caution not to set the blocks of result boxes to tight or it could be that the wrong box is picked.

    https://drive.google.com/file/d/0B5FlDY ... sp=sharing

  • Because your ball never hit exactly x=280.

    If you have a speed of 240 in your bullet-behavior, the ball will travel 4 pixel each tick, if you set the ball in the beginning to x=1 every tick it will travel 4 pixel, so after the first tick it is x=5 then x= 9 and at least x=277 and x=281

    so it will never trigger x=280.

    Even if you set it to x=0 a little slowdown could alter delta time and you will miss x=280 again.

    Better is to use x>280.

  • First at all your game looks great and a very nice idea.

    I think I can't really help, your game is quite to big and I have not enough time to understand it completely.

    But I saw in your "SetearCajaResultado"-Function something that bothers me. I don't know if this could be your problem, but the first event in this function, you have an 'and'-block with 'pick all' and 'pick Caja where Caja.AsignarNumero=0'. If your player has a collision all blocks would be picked and all blocks would spawn a number. Anyway, the first condition with pick all should be necessary at all. But this is a wild guess I don't looked your game completely through.

  • [quote:1w5iiw1w]

    Why doesn't something like my example work - what am I missing?

    Because your two events fight against each other.

    If there is a collision the first event will still trigger, so the first event rotate the sprite to sprite1 and move 1 pixel and second event rotate the sprite to sprite2 and move 1 pixel at the end nothing will happen.

    Here an example that should work:

    System On start of Layout -> Sprite Set angle toward(sprite1.x,sprite1.y) 
    System Every tick -> Move forward sprite.speed*dt pixels
    Sprite On collision with sprite1 ->Sprite Set angle toward(sprite2.x,sprite2.y)  
    [/code:1w5iiw1w]
  • [quote:wxp0l1kx]

    1. How did you setup the instance variable for sprite2 for it to show as <varies>

    You can set instance variables individual for each by click on the instance in the layout and set it. If you click then in the Objects-Windows of the one object it will show no value (or varies in the add instance variable window), because the instances have different values.

    [quote:wxp0l1kx]

    2. Would the speed of moving sprite vary according to the performance of the target machine?

    Yes it would, you can prevent this if you use delta time. In this example: 'Move Forward 60*dt'.

    This uses delta time 'dt' which is the length between the ticks (normally 1/60 sec for 60 frames per second).

    If your game slows down the length between the ticks will grow. So, it will prevent that it will goes slower but it will go choppier. And if it goes to slow you can get problems with collision, because if your sprite does every tick a hop of 20 pixel it can miss the trigger for the collision and go through a wall or enemy.

  • I made a little example. Hope that will help.

    https://drive.google.com/file/d/0B5FlDY ... sp=sharing

  • I tried something and it works, but I don't know if it is exactly what you want. I changed a little bit and don't use the 8Dirction-Behavior and I have a little bit problems with wait. So I have to use a Direction 0, because if I put the wait from Direction 0 in Direction 2 it doesn't work. Maybe a more advanced programmer could say why.

    https://drive.google.com/file/d/0B5FlDY ... sp=sharing

  • If I'm not totally wrong you compare your variable measure with the distance, you don't set it.

    That what look like.

    System Every tick -> set measure to distance(Player.X,Player.Y,Guard.X,Guard.Y)
                         set text to "Distance: "& measure
    [/code:8hyf1flo]
  • I Edit my post. Please look again if this works better

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Edit: was nonsense

    I changed a little bit in your order.

    And it seems to work.

  • I hope I understood the question correctly. It would easier to answer if you had provide a capx.

    But what I understood so far, you could use: System Pick all (your objects) -> set direction=2

    Then all instance variables of your objects should be set to two.

  • Hi balsh,

    I made an example that seems to work.

    https://drive.google.com/file/d/0B5FlDY ... sp=sharing

    But I had trouble that an enemy stuck on another enemy after some amount of time. The same effect did I had with the solid behavior.

    So the enemies now hold a distance from 2 pixels if they collide. Fewer and they will stuck. It is possible that if your game get choppy they will stuck on each other again. Then you have increase the distance.

  • entryz

    You're welcome. Don't hesitate to ask if there is something unclear.

  • imagine you have numerous grids that form a single entity and you have to duplicate that entity multiple times, with Object Orientated Programming, all you have to do is to make them all into a Single Class/Object and then just instantiate their single Object.

    Isn't that what Containers do?

    Placing objects in a container has the following effects:

    If one object in a container is created, every other object in its container is also automatically created.

    If one object in a container is destroyed, every other associated object in its container is also destroyed.

    If a condition picks one object in a container, every other associated object in its container is also picked.

    You have even some kind of constructor with 'On created'.