R0J0hound's Forum Posts

  • Plugin development is anarchy. I don't think there is any set opinion how it should be done. Even vanilla features don't adhere to a set standard. Things were just added and improved over time. So in the end you can just do things however you like I say.

  • Apart from using it with the ?: operator, I’ve used = for stuff like this:

    Say you want to convert a small list of color names to a color values you could do:

    rgba(100*(color="red"), 100*(color="green"), 100*(color="blue"), 100)

    Or if you happened to want to handle different colors or more of them:

    chooseIndex((color="red")*1+ (color="green")*2+ (color="blue")*3, rgba(0,0,0,100), rgba(100,0,0,100), rgba(0,100,0,100),rgba(0,0,100,100))

    Granted there are better ways if you wanted to handle lots of color names but this is handy and simpler for a few.

  • Var n=4

    On sprite clicked

    Repeat n times

    — create line at sprite.x, sprite.y

    — line: set width to 0

    — line: set angle to 360/n+45

    Every tick

    — line: set width to min(100, self.width+200*dt)

    Line: width=100

    Trigger once

    For each line

    — create sprite2 at line.x,line.y

    — sprite2: move 100 pixels at angle line.angle

    — create sprite3 at sprite2.x, sprite2.y

    — sprite3: set frame to loopindex

  • Well you can do it with a bunch of conditions. For two vars

    If A>B

    If B<A

    If A=B

    For three you just do the same for all cases

    a>b and a>c

    B>a and b>c

    C>a and c>b

    A=b and a>c

    A=c and a>b

    B=c and b>a

    A=b and b=c

    For four it would be similar.

    Another way would be an array.

    3 a

    22 b

    4 c

    Then you could sort the array to get the greatest, but you’d need some logic to when there are multiple with the same value.

    A third idea that I like best is to use sprites instead. Make a sprite called item, give it two variables: name and value. Then just create an instance for each fruit and set the vars.

    Finally to get the highest and get a random one when there is a tie you’d do:

    For each item ordered by item.value+random(0.5) descending

    — set best to item.name

    — stop loop

  • Presumedly yes. I don’t know what would be amiss otherwise.

  • As long as the json you load is the same format as the json you saved from the dictionary it should work. You can’t just load a general json into a dictionary.

  • If your animated sprite has the platform behavior the size and collision shape can be changing per frame which can lead to overlaps. Just hazarding a guess, construct’s collision resolution logic may not work well with pushing a concave shape out of something?

    To make motion more stable you’d typically have the player be an invisible rectangle with the platform behavior, and the animations would be a different sprite positioned on top of it.

    So you’d only want to do your own collision response if the performance was good, not if it worked better? Anyways you’d have to make it and see how it performs. Most custom collision response I’ve done seems fast enough.

    Isn’t p5.js just a different engine? From what I’ve found different engines don’t play well together. But I guess you’ll see how true that is if you try it.

  • One idea is a Text instance per letter and store the original character in instance an variable. Then it's just picking after that.

    Another idea is utilizing left, mid and right to modify a text variable. For example text = left("********", n) & right("Codeword", 8-n) to change the first n characters to stars. Or to change the nth character to a star: text = left(text, n)&"*"&right(text, len(text)-n-1) But there's more to it than that probably.

  • One idea is to make a sprite of a ring and spawn that where the player is. Then you have the rings increase in size and fade in opacity. You could play around with how you draw the ring. Maybe have feathered edges, and maybe shade it. You can also play around with using the additive blend on the rings. There may even be a shader to distort the texture underneath.

    To limit this effect on water tiles you'll need to mask it somehow. Put the rings on a layer with force only texture and a tilemap on top with the destination-out blend. There may be cleaner ways to mask it with sub-layers or other blend modes.

    You could also do it as a simulation. Basically each point of water has a spring to make it return to a normal level and there are also springs connecting the 4 adjacent point of water. This could be done with an array. Then to draw it you could draw it with drawingcanvas if you want to simulate per pixel, or maybe utilize a distort mesh for a simpler sim. You could it with a color gradient based on depth. For mesh that would mean you'd use a gradient texture and mess with the uvs to have a color per vertex. Alternately you could color it like a normal map. The latter could be more useful when used with effects but you'll have to look into what's available for distortion effects. There are other ideas to explore here.

    Limiting all that to just the water still requires making. Or just make the ground drawn higher.

  • Probably when moving fast the objects move too far so it incorrectly guesses which way to resolve the collision.

    Here's a slightly different way to do it that supports rotated boxes and wedges. It treats the player as a ball. The collisions are resolved in the closest direction so when on a slope you'd slide down.

    dropbox.com/scl/fi/06pnm5xx1c1z92h9u09vl/3d_box_and_wedge_collsion_response.c3p

    You can break this too. With a radius of 16 you can go up to 1000 pixels per second and still work at 60fps. 1000/60 = 16. Higher speeds can pass though walls. To fix you can use larger radius', slower speeds, or move in multiple smaller steps per frame so you can check multiple times.

  • Looks like you’re creating the four objects in specific locations. You could compare the x and y to pick specific ones. You could give the object an instance variable and set the variable to something unique when you create it.

    Start of layout
    — create sprite at 100,100
    — sprite: set var to “left”
    — create sprite at 200,100
    — sprite: set var to “right”
    
    On clicked on sprite
    — sprite: var= “left”
    — — do something
    — sprite: var= “right”
    — — do something else
  • Had another look at getting cleaner formulas than what C3 uses internally and here we are:

    Looks like c3 rgb values are 10bit +1? alpha is 10bit. Anyways here's the conversions.

    red = round(int(-color / 2^38) % 2048 * 255/ 1024)
    green = round(int(-color / 2^24) % 2048 * 255 / 1024)
    blue = round(int(-color / 2^10) % 2048 * 255 / 1024)
    alpha = round(-color % 1024 * 255/ 1023)

    Tested with thousands of random colors and it works flawlessly so far.

    Note:

    C3's rgb expressions only return negative numbers which mean the colors are stored in 10bit per component, and works with the above formulas.

    If you're curious, positive values mean it's a color with 8bit per component color=r*256*256*256+g*256*256+b*256+a where each component is a value 0-255. C3 still supports colors like that but you'd have to generate them manually. Also you'd need different formulas to extract the components. However that's easily found online if needed.

  • I don’t believe so. Likely the waits are checked after the event sheet runs or something.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not really. You'd just need to pick your poison.

    Using sprites for everything is one way but picking isn't great to deal with when comparing different instances of the same type.

    You can avoid using the array plugin with text variables to some extent. To access data you need to parse the text. To modify the text you often need to rebuild it.

    Data plugins such as json or array are rather abstract but are useful if you can wrap your head around them. There may be other third party plugins that maybe are simpler? Anyways one pro about data plugins is avoiding using picking as much.

    Javascript can make it easier to deal with data but I guess that depends on what you're comfortable with.

    At a small scale I've seen just using a bunch of variables work too. But that tends to require more events.

    In practice I figure out what I want to do on paper first and how it should work. The last step is to figure out how to do it in construct using the least amount of features as possible.

  • Simplest would be to just make a tiled background of a grid and use that.