R0J0hound's Recent Forum Activity

  • You could look into listening to pointer events which apparently work for styluses.

    developer.mozilla.org/en-US/docs/Web/API/Pointer_events

    However I have an older stylus that just moves the mouse when close to the surface. Maybe it’s something you can configure with your stylus’s settings.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • As an implementation detail 1 meter = 50 pixels in the physics behavior. We shouldn’t need to worry about that except the conversion was inconsistently applied to all the values when you get values. So often values are off by a factor of 50.

    64x64/50 =81.92

  • Construct maps touch and mouse coordinates from the screen into layout coordinates. If you transform the canvas those will be off. In concept you can get the mouse coordinate on the screw and transforming it by the inverse of the matrix and take that and map it to layout coordinates. But that’s more low level so you’d end up only being able to use touches and clicks and get coordinates with your own math. The devil is in the details though.

    My other thought is if dragging changes the distort you may run into the issue of it running away from you as you drag. Could be better to have the dragging done on something that doesn’t get distorted.

    Anyways just some thoughts.

  • Pardon my ignorance but wouldn’t this be something that’s commonly handled by the projector itself? Like when you place the projector you tweak its settings so the image isn’t distorted on the wall?

  • So you’re using the array so that its size is:

    (Count, numProperties,1)

    And you access values with:

    Array.at(n,property)

    Where n is the index to the object and property is:

    0 for x

    1 for y

    2 for zindex

    3 for name

    … and so on if you add more properties later on.

    Looks like you already have saving down but here is an example. You can set the array size first and just fill in values but I find it’s easier to increase the size as you add objects, especially if you have multiple types you’re saving. Anyways, “push” or “insert” basically will change the size of the array, but to be super clear about it you can just set a new size like here.

    On function “save”
    — array: set size to (0,4,1)
    — for each sprite
    — — array: set size to (self.width+1, self.height,1)
    — — array: set at (self.width-1, 0) to sprite.x
    — — array: set at (self.width-1, 1) to sprite.y
    — — array: set at (self.width-1, 2) to sprite.zindex
    — — array: set at (self.width-1, 3) to “sprite”

    For loading you’d still do “for each x element” instead of xyz. And you’d use array.at(n,3) to get what the name of the current object is.

    On function “load”
    Array: for each x element
    — compare: array.at(array.curx,3) = “sprite”
    — — create: sprite at (array.at(array.curx,0), array.at(array.curx,1) 

    Now a further improvement so it actually loads the objects in the same zorder as you save it is to rearrange the order of the values to {zindex,x,y,name} and sort it. That would only change the save function.

    On function “save”
    — array: set size to (0,4,1)
    — for each sprite
    — — array: set size to (self.width+1, self.height,1)
    — — array: set at (self.width-1, 0) to sprite.zindex
    — — array: set at (self.width-1, 1) to sprite.x
    — — array: set at (self.width-1, 2) to sprite.y
    — — array: set at (self.width-1, 3) to “sprite”
    — array: sort by x
  • Remove the trigger once. It does nothing when under a loop.

  • When creating an object at runtime construct copies the properties of the ‘default’ instance of that type. That instance is the first one placed on the lowest layer in the lowest layout with that instance. That’s why dop suggested having a layout with the default instances. It probably should be the first layout though.

    Another option is to use templates instead. Notice when you create an object you can specify a template. As I recall you can create a template in the editor from a selected instance. Do refer to the manual for specifics.

  • In that video no pathfinding is needed. If you give sprites the physics behavior they will not overlap. Just set gravity to 0 and apply forces to the objects to move them around.

    The pathfinding behavior does two things. It finds a path and moves along it. Anything we do to prevent objects from overlapping will be in conflict with it moving along the path.

    Probably a solution is to take the path and do the movement yourself instead of letting the behavior do it. Aka use the pathfinding behavior to find the path and the physics behavior to move it. Roughly you’d apply a force toward the first node of the path and once the player was close enough to that node you have to change to target the next one.

  • You have to add the sprite to a family so you can pick two instances independently

  • What if you generated a random number from 1 to 4 and if it’s 1 change the first variable, or if it’s 2 the second, and so on.

  • You don’t change it. It’s calculated from the fov so that the 2d layer is unscaled. Consider that property as just informational.

    If you want to move the camera you can with events.

  • You can’t independently scale the xy of a layer in construct.

    I guess drawing everything to a canvas and scaling that could be an option in theory.

    Another idea is having an effect to do it. Might be able to modify the pixelate effect to do it.

    Final idea is to just draw your graphics with double pixels.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound