dop2000's Forum Posts

  • Yeah, random() starts with 0. So floor(random(3)) is the same as choose(0,1,2), but it will never equal 3.

  • I agree with what you are saying, but have you actually tried running random() and choose() a million times and comparing them? I have tried it just now on my very low-end android phone (which probably costs about $20 now).

    1,000,000 calculations of round(random(17)) take about 5 seconds.

    1,000,000 calculations of choose(1,2,3...,17) take about 6 seconds.

    I really doubt that igalencar needs to spawn one million explosions at once, and even if he was, the difference in performance of these two math functions would be the least of his worries.

  • See my first comment in this post, there is a code that sets jump and speed variables to values from the array.

  • You can just pin a cone sprite, but it will not be blocked by obstacles.

    If you want it to look realistic, you can try this method:

    construct.net/forum/construct-2/how-do-i-18/how-do-i-make-an-enemy-line-of-130966

  • Did you mean "swipe"? (Not "spin")

    If you want to detect swipe gestures, you can use Touch.SpeedAt(0) and Touch.AngleAt(0) expressions.

    For example:

  • Well, you can send me your project privately if you want.

    You can find my email here.

  • There is practically no difference in performance between using floor(random(17)) or choose(1,2,3...17).

    You can try them in "Repeat 1000000 times" loop and you'll see that both expression take the same (very little) time to compute.

  • Maybe your LOS settings are wrong - distance too short or something similar. It would be easier if you could share the project file.

  • That's just the AJAX tag name - "Animations". You can rename it to whatever you like, "ItemsArrayData" for example.

    Tags are needed in case you are requesting multiple files with AJAX and you need to know which is which.

  • That's way too many frames for a simple explosion! Why do you need 17 animations?! Just use one or two, randomly flip, mirror, rotate, apply some effect and you can save lots of memory!

    Also, you can make very resource-efficient explosions with particles. (see Particle Explosions template in C3)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is the sound played? Maybe there is something wrong with the bullet (spawned on the wrong layer, for example). I suggest you add debug output (Browser->Log) to different events to see if they are getting triggered.

  • Array.width means the number of elements (or columns) on its X axis. In your case it's the number of items, +1 for the column with labels.

    I meant you should give your animations in the Items sprite the same names as you have in the array - "Spring_Helmet" animation, "Rock_Helmet" animation etc. It will make everything much easier.

    .

    You need to experiment, try other people's projects and tutorials, change different things, see what happens etc. This is the only way to learn in programming.

  • kriand beat me with the answer, but since I've already typed it I'll post it anyway :)

    In the array editor columns are X axis and rows are Y axis.

    For example, to get "Jump" property of Spring_Helmet, you can use Array.At(1, 4)

    The "FULL NAME" row from your table can be a unique identifier/code of each item. You can use the same code as animation name.

    So to pick a random item from the array you can do this:

    Set local variable randomItem to int(random(1, Array.width))
    ItemSprite set animation to Array.At(randomItem, 1)
    if Array.At(randomItem, 3)>0 : Set P1_Speed to Array.At(randomItem, 3)
    if Array.At(randomItem, 4)>0 : Set P1_Jump to Array.At(randomItem, 4)
    etc.
    

    Or you can create a bunch of functions to retrieve different stats from the array, as I did in the example I gave you in one of your previous posts.

    .

    PS: you should not use the first column of your array for labels. something like that is in better hands separately.

    Why not? He just needs to remember that X=0 is reserved for stats names.

    Having this column makes it easier to edit data in the Array Editor. Also it allows to create a universal function "GetItemStat", that will return any stat for any item, say Function.Call("GetItemStat", "short_sword", "damage")

  • Tom, Redirection still doesn't work for many old posts. If you try clicking links from FAQ, about 30-40% of them won't open.

    Also many external links completely disappeared from posts and comments. For example, half of the comments in this extremely useful post with audio resources now look like this:

  • Non-static local variables reset to their default value on every tick. So it's not possible to monitor them in Debug mode. You can only see static local variables.

    Use Browser-Log in events to output the contents of local variables to browser console.