R0J0hound's Forum Posts

  • Ashley is male and reporting bugs has always been unrewarded.

  • If you’re using the move to behavior to move the object then you need to use the moving angle of that. I only used 8dir as an example as I had no idea what behavior you used to move.

    On a slightly unrelated note I see you used pi/180 in your expressions. That isn’t needed. Construct uses degrees for everything so you practically never have to convert to radians.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe:

    Player: 8dir: is moving ?

    — player: play animation sin(self.8dir.movingAngle)<0?”walkNorth”:”walkSouth”

    —player: set width to abs(self.width)*(cos(self.8dir.movingAngle)<0?-1:1)

  • To expound on the math idea here’s how to calculate the y to place the object just off the bottom of the screen. Untested but the math should be correct.

    Var s=0
    
    Start of layout
    — create sprite at 320,240
    — sprite: set zelevation to random(-150,0)
    — set s to 3dcamera.DefaultCameraZ/(sprite.zelevation-3dcamera.DefaultCameraZ)
    — sprite: set y to viewportHeight(0)/2/s+self.height/2+scrolly
  • So you want the projected bounding box of the object at different z elevations.

    You may be able to get somewhere with the expressions to convert from a position to a layer.

    Mathematically you should be able to calculate it with the object’s position and the fov of the camera. Basically a 3d projection to the screen if you want to find more info about that online.

    A third way is to just do some trial and error.

    Like set y to y to self.y-k*self.zelevation

    Fiddle around with the value of k till everything is just offscreen.

  • Set it invisible till you finish positioning it if you do it over multiple frames?

    Or depending on the size of the object you’d need to create it further off screen so it’s not seen.

  • Maybe try disabling workers in the project properties. Otherwise if the code is run in a worker you’re limited what you can access. so maybe that’s why window.parent isn’t defined.

    That’s the idea at least. I did some minimal digging for docs about that and some minimal testing, but I’m not really going to explore that further.

  • You just use JavaScript directly in construct 3. Right click in the event sheet and add JavaScript. It serves the exact same function as execjs

  • Have you first checked that the TimeLeft variable is set 100 so that it can run?

    I guess you could check to see if those load actions take the name of the file or do they want the contents of the file. If they need the contents you could paste that into the action or load the file with ajax into a variable or something.

  • I won’t be able to show an image of events. But it would basically be what I wrote.

    Here’s another way that just skips the json object. Basically store the json in a text variable, loop over the characters, have one condition to have it only look at letters, and a second condition to see the letter was listed yet. And finally adding the letter to a unique list.

    Global text letters=“ABCDEFGHIJKLMNOPQRSTUVWXYZ”
    Global text json=…
    Global text unique=“”
    
    Start of layout
    Repeat len(json) times
    Compare: find(letters, mid(json,loopindex,1)>-1
    Compare: find(unique, mid(json,loopindex,1)=-1
    — add mid(json,loopindex,1) to unique
  • Easiest is to have an empty dictionary and then loop over each letter or each word and add that letter as a key to the dictionary. You’ll end up with one key for each unique letter. You can then loop over the keys to get the letters.

  • The least technical way to do it is just make the level up of a bunch of individual objects that you reuse all over. Tilemaps let you do that in a grid.

    Just drawing a big image for the level may work for the level visuals but you’d still need to indicate the collisions some other way. And depending on how big the image is you may run into video memory or max texture size limitations on some lower end systems.

  • Here's for 0 to 99

    mid(" १२३४५६७८९",int(level/10)%10,1)&mid("०१२३४५६७८९",level%10,1)

    or this

    (level>9?mid("०१२३४५६७८९",int(level/10)%10,1):"")&mid("०१२३४५६७८९",level%10,1)

    And 0 to 999

    (level>99?mid("०१२३४५६७८९",int(level/100)%10,1):"")&(level>9?mid("०१२३४५६७८९",int(level/10)%10,1):"")&mid("०१२३४५६७८९",level%10,1)

    or 0 to 9999

    (level>999?mid("०१२३४५६७८९",int(level/1000)%10,1):"")&(level>99?mid("०१२३४५६७८९",int(level/100)%10,1):"")&(level>9?mid("०१२३४५६७८९",int(level/10)%10,1):"")&mid("०१२३४५६७८९",level%10,1)

  • You’ll probably have to restate the question. And no, just adding /2 isn’t what I was suggesting.

    What alexto suggested is elegant imo. It reduces all those events down to one event. And anything can be modified to meet other requirements you may have later. We generally reply with ideas that ideally you can then use or maybe modify to be useful for you.

    I don’t get the idea that formulas are your thing. I mean we all are at different levels. So here’s one last attempt.

    315 to 45 should be -22.5 to 22.5

    0 to 90 should be 22.5 to 67.5

    45 to 135 should be 67.5 to 112.5

    … and so on

    Notice the pattern? Where one range stops the next one starts so there is no overlap and no directions will seem to be skipped.

    I’ll leave it to you to find the other ranges but you can calculate them with:

    a-45/2 to a+45/2

    Alexto’s formula rounds an angle to the nearest 45 and combines it with an animation lookup. That’s super useful to simplify things.

    The meat of it is round(a/45)*45 which rounds to the nearest 45.

    And sure he wrote it for one animation type but it should be trivial to use the same idea for other animation types.

    Anyways, that’s should get you some ideas maybe. I don’t think I can give anything simpler that wouldn’t require a lot of extra work on my part.

  • If visuals help you could draw a circle cut into 8 slices like a pizza and measure angles of the edges.

    Otherwise I’ll just defer to suggestions of others.

    Again it looks like the angle ranges you’re using are overlapping each other which makes it seem like things are being skipped. You need to reduce the angle ranges so they don’t overlap.