R0J0hound's Recent Forum Activity

  • This post may help.

    Sampling pixels is a relatively slow operation that adds up when doing it multiple times. In javascript you can copy a whole pixel area to an array. The result is very fast sampling of any of those values. The expression in the canvas object is .AsJSON and it returns a json string that then can be loaded in the Array object.

    I added it as an experiment so it isn't very user friendly. For one the array size is [1, 1, width*height*4] and to access a particular pixel you have to do it with [0, 0, (width*y+x)*4+i] where i is 0 for red, 1 for green, 2 for blue, and 3 for alpha. Also all the pixel data is in the range of 0-255.

    With regard to performance, one rgbaAt() is faster than one .AsJSON, but .ASJSON becomes faster when you want to sample many pixels. Also the bigger the canvas the slower it is, so when you only need to check a smaller area you should paste the canvas to a smaller one and use .ASJSON on that.

    Also alternatively Another idea is to just copy the terrain to an array to read from and clear it manually when you clear parts of the canvas. Tedious, yes but gives good performance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If my variable1 is 1 then the following conditions, actions and sub-events won't run.

  • Cool. Do you do any keyframe blending or is it just straight keyframes? Thought about adding rotation?

  • Here's an example that can get you most of the way there. You'll probably need to position the object overhead before pinning though.

  • Keeping track of what waypoint the car is on is a way to give a very rough estimate of the rank. You can get a finer rank by also considering the perpendicular distance to the next waypoint.

    So the event needed would basically look like this:

    For each car ordered by waypoint*1000-perpDistToWaypoint decending

    --- loopindex+1 is the rank.

    If the distance between checkpoints can be more than 1000 change it to some higher value.

    Ex.

    https://www.dropbox.com/s/y3xhf4wp2t6kh ... .capx?dl=1

    /examples26/laps.capx

    The perpendicular distance is the dot product between the waypoint line and the vector from the waypoint to the player. It can actually give us negative distances so we'll put it in a abs() so it's always positive.

    Player = {x, y}

    waypoint_to_player = {x-way.x, y-way.y}

    waypoint_line = {cos(waypoint.angle), sin(waypoint.angle)}

    perp_dist =abs( waypoint_to_player dot waypoint_line )=abs( {x-way.x, y-way.y} dot {cos(waypoint.angle), sin(waypoint.angle)} )

    = abs((x-way.x)*cos(waypoint.angle) + (y-way.y)*sin(waypoint.angle))

    vector

  • No, but from the best I can tell:

    solModifiers is the current selected object list state, or something to that effect. Basically what's picked.

    pushCopySol() Saves the current sol to a stack.

    popSol() Restores what was saved from a stack.

    More details about it can be found be poking around the source.

  • The most info you can find is from the manual:

    https://www.scirra.com/manual/26/runtime

    The function basically grabs the current position in the event sheet and runs the subevents from there multiple times. Once for each dictionary key.

  • Well you can't really disable it. The most you can do is change the "runtime" property (below the eye distance property) from direct-X9 to application. But then the game will have no graphics at all.

    Also if the server has a display then it has a graphics card. It sounds more like you need to install directx or something.

  • How does the eye distance have anything to do with the crash? Did it start crashing after setting it to 0? Eye distance is mainly for 3d objects and objects with ZElevation. Why do you want to disable it? If it's perspective you want to disable you can do it with the system action "set projection mode".

  • It's needed in that case since the rotation is being done manually. "Rotate" is not part of the behavior.

  • If you want to create a gradient at runtime you can use the canvas plugin for that.

  • There are a few ways.

    One is to give the the object the bullet behavior and add an event like this:

    Every tick

    --- sprite: rotate 10*dt degrees toward -90

    Where 10 is the turning speed in degrees per second and -90 is the end angle.

    Another way that is useful from a trigger is to add a instance variable "turningSpeed" to the sprite to tell how fast it turns.

    Every tick

    --- sprite: rotate clockwise self.turningSpeed*dt

    start of layout

    --- sprite: set turning speed to -90

    --- wait 1.0 seconds

    --- sprite: set turning speed to 0

    --- sprite: set angle to -90