tulamide's Recent Forum Activity

  • Thanks you for that. Is the "or" function in general a bit bugged, or only if you use it wrong?Well, it does not work as it should, so I'd say in general.

    Basically it is a time issue. Here is a description of how to get 'OR' working, or why it does not work correctly:

    http://www.scirra.com/forum/why-using-or-seems-to-fail-often_topic40925.html

  • Using 'OR' to combine conditions can cause problems. To avoid them, you need to find a way to compare logically without using 'OR'. There is a way, and it is the system object's evaluate condition.

    Instead of one event with 3 conditions, like so:

    + System: Is global variable 'keyDown' Equal to 0

    + System: OR

    + System: Is global variable 'keyDown' Equal to 2

    You'd use the evaluate condition, like so:

    + System: global('keyDown') = 0 Or global('keyDown') = 2

    That looks great, and it works, too. But what to do, if you need to 'or' triggers? You can't access them in expressions. But you can do an intermediate step to convert a trigger to a variable.

    + System: Always (every tick)

    -> System: Set global variable 'keyDown' to 0

    + MouseKeyboard: Key Right arrow is down

    -> System: Set global variable 'keyDown' to 1

    + MouseKeyboard: Key Left arrow is down

    -> System: Add 1 to global variable 'keyDown'

    + System: global('keyDown') = 0 Or global('keyDown') = 2

    -> do something, when both or no keys are down

    The logic behind this example is that on every tick 'keyDown' is first reset to 0, then set to 1, if the right arrow key is down. After that, 1 is added to 'keyDown', if the left arrow key is down. Here are the sequences of setting 'keyDown' before it is or'ed:

    left and right both not down:

    0, 0, 0 -> 'keyDown' = 0

    left is down, right is not down:

    0, 0, 0+1 -> 'keyDown' = 1

    right is down, left is not down:

    0, 1, 1 -> 'keyDown' = 1

    right is down, left is down:

    0, 1, 1+1 -> 'keyDown' = 2

    The last step now compares if either one of 'keyDown' = 0 or 'keyDown' = 2 is true (which stands for either no key or both keys down) and gets executed only, if it evaluates to true.

    You can do this or any similar way (you might prefer working with dedicated variables per trigger), wherever you need to 'or' conditions.

  • English is not my native language, so I might have chosen an inaccurate expression.

    With time-stable I mean that the presented "divide&conquer" algorithm in Verve always needs the same amount of time to sort per cycle, no matter if there are, e.g. 100 or 100000 elements to sort, while bubble sort uses much more time per cycle if there are more elements.

    EDIT: For example, with 100000 elements the algorithm in Verve always needs about 8 cycles to sort, while bubble sort in the worst case needs 99999 cycles.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can't duplicate it without being able to access the alpha channels of the textures. If it is possible with javascript (or whatever is the language) to hook into the rendering process, then paint everything black where no object is placed on a certain layer, but paint the background where those objects are. That's basically it.

  • 1) Yes, but it's about microseconds with such small range of values, so you don't need to take it into account.

    2) I never stopped pointing towards my example game "Verve!". It covers so much and of course it also shows how to sort an array. It uses a more complex but time-stable algorithm. http://www.scirra.com/forum/example-verve-a-mini-game-of-skill_topic41461.html

    You could do a simple bubble sort as well. It will get slower the higher the count of values to sort, but that's negligible with the count you have in mind.

  • I'm not quite sure what causes the problem. I admit, the two pictures are not enough for me to find the cause. But the loops itself are very confusing. Maybe there's one of the issues. If I understand it right, you're looping through every 'NonPlayers', which is an action per tick. But as a subevent you're running 'every x milliseconds', which is an action over time (-> several ticks). I doubt this works. You would only get the first (time + 0 milliseconds) loop of it. All other loops are subevents of that 'every x milliseconds' event.

    If you get rid of the 'every x milliseconds'-event, deactivate the super-loop of s and move the 'DebugText'-action up into the 'for each Players'-event, does it show all 'ClassID' then? (You may need to alter to "Set Text to .Text & Players('ClassID') & ", " )

  • Thank you, zyblade :)

    I hope it still is of good help for all our new developers here.

  • No, I don't mean families. You can directly test against the attribute solid.

    Select the bullet sprite and use its "on collision with another object" condition. On the parameters page click on "pick an object". The list that opens is catagorized. Further down the list you will find the category "Attributes", where you can select "Solid". Of course, this option only appears if at least one of all the objects has the attribute "Solid" (which you can activate under Properties/Groups/Attributes of the sprite's properties panel).

  • Use the group attribute "Solid" in the condition:

    + bullet: On collision between bullet and "Solid"

    -> bullet: Destroy

    This definitely only destroys the instances that are colliding.

  • While Unreal Engine 4 recently attracted with some fine videos that are hopefully realtime renderings (e.g.

    Subscribe to Construct videos now

    ), I am much more fascinated from the fact that engine 3 now runs from within flash. They somehow managed to encapsulate the engine, it works, and it is soooooo cool what you get to see in realtime within flash within a browser:

    epic citadel

    (use wasd for moving/strafing, e to jump, left mouse button down to drag view)

  • also, to make things more interesting, how can i make a random value between two values?

    for example if i want to give a sprite a random size between the sizes 50pixels and 90pixels?Just add the offset to random() and use the range+1 in random. For example:

    50 + random(41) => creates a random number in range [50, 90]

    23 + random(101) => creates a random number in range [23, 123]

  • Yes, you can. Use the "File" object. The condition "for each file" is pretty much all you need.

    Create a text variable (e.g. 'soundpath') and set it to the path of your sound folder.

    Then call "for each file" with that path, create a button and store the path to the current file somewhere (I would use a sprite with a pv 'filepath' as a button). When it comes to play a file linked to a button, pass the stored path to either "autoplay file" or "play music from file" of XAudio2, depending on the sound format.

tulamide's avatar

tulamide

Member since 11 Sep, 2009

Twitter
tulamide has 3 followers

Trophy Case

  • 15-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

17/44
How to earn trophies