R0J0hound's Forum Posts

  • megatronx

    That’s how the pasting was made to work. It’s just drawn in place where the object overlaps the paster object. Hence the stamp icon.

    The quad draw function wasn’t meant to use an object’s effects, only its texture.

  • Over time the ball could lose some height with most all the behaviors.

    Here’s a way to not lose speed or height over time. The height will vary slightly but stay around the same.

    Var gravity=500
    Var vx=100
    Var vy=0
    
    Every tick
    — add gravity*dt/2 to vy
    — ball: set position to self.x+vx*dt, self.y+vy*dt
    — add gravity*dt/2 to vy
    
    Ball: collides with wall
    — set vx to -vx
    
    Ball: collides with ground
    — set vy to -600
  • What you showed was the non-interactive part which could be a fixed video, although I’ve seen that ad where it is interactive.

    It’s probably a mix of pre-baked videos of the fluid and actual fluid simulation in local areas, although it’s just a guess. Most fluid simulations are grid based or particle based or some mixture of the two. Or maybe they were clever and found a way to just reuse water animations and blend them together.

    This channel shows two ways that fluid simulations can be done in general (it’s not construct related).

    m.youtube.com/watch

    m.youtube.com/watch

    You poke around the forum for construct related examples. The simplest would be to using a lot of small physics balls to do the simulation. It doesn’t scale well though. Another is just simulating the surface.

    Overall the event system is a bit heavy to implement a water sim. The physics behavior is a bit better but it doesn’t behave the same and also is a bit heavy with that many objects. JavaScript would be the fastest way to go, or maybe using an existing library. It’s just the matter of getting it to play nice with constructs engine.

    The main issue getting some custom library to render in construct. You need to modify how the library renders so it just uses constructs renderer which may or may not have all the features you need. Another approach is trying to modify constructs renderer instead, but it’s not designed to allow that easily and officially it’s discouraged and not supported. A third way is to just have a separate canvas with its own renderer and you’d layer the canvas’ on top of each other.

    Anyways. Just some general ideas. Personally I’d try to somehow fake it as much as possible.

  • megatronx

    Sorry, I'd avoiding any aspect of making plugins and I'm not a fan of debugging ai generated stuff.

    megamente Br

    Alexander Wiseman

    I haven't used this plugin in months but I tried it and it works here. You'd load the texture to a tag, say "tex" then set the object's texture to that tag. As long as your mesh uv's are good then it should show the texture.

  • Well what’s causing it will be hard to spot. The waits make it hard to know the exact order things are run. Maybe don’t let the function run until the previous one completes. After all the order you want things to run is fixed. You could also try the timeline or just make it in one function so it’s easier to follow the logic.

  • So as you have it now the “every 0.01 seconds” it would trigger ~100 times a second on a 240fps screen, and 60 times a second on a 60fps screen ( since anything lower than dt is dt with every x seconds.

    If you want it to update at the same fixed rate you could remove the every 0.01 seconds and do something like this.

    Var t=0
    
    Every tick
    — set t to t%1
    — add 100*dt to t
    
    Repeat int(t) times
    — do stuff

    Or did you want it to be continuous instead of doing the steps you were using?

    For that, remove the every 0.01 seconds and change the set x’s from:

    Set x to self.x+rate

    to

    Set x to self.x+rate*100*dt

  • I think if you add a for each enemyspawnarea to event 157 it should fix it.

    The on timer trigger doesn’t seem to trigger for each instance individually. Instead all the instances that finished their timer in the last tick are picked in the trigger.

    For example without the “for each” if two spawners finish their timer in the last tick and they are both “white to red” then only one would be added to the count. The for each would make it add 1 for each.

  • No idea. The slash should be spawned on the sword. Maybe look at the slash hotspot?

  • Is a minimap that hard to make? It's basically a scaled down map of the level with markers where things are, or some variation of that. The forum has a lot of posts about them and at least a few examples. If you're having issues making one you could make a topic as there are a lot of knowledgeable folks that could maybe help.

    Guess you could look at the reviews which seem to be mixed but they do seem to respond to issues so maybe the cost would give you user support? Honestly most of what's on the store is doable with vanilla C3 from what I've seen. But I'm not the target audience, as I've never bought anything from it...

    Anyways here is a minimap done with three events.

    howtoconstructdemos.com/round-minimap-demo

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just move the paster object onto the screen before pasting to avoid the view culling. You can move it off screen immediately after.

    I never downloaded that plugin. I only have some of the plugins I made installed.

  • Ex = scrollx

    Ey = scrolly

    Ez = 1/tan(fov/2)

    So ex,ey is the center of the screen, and ez if that. That formula was buried in a paragraph after the equations in Wikipedia.

    At a glance it looks like you’re building the camera orientation matrix with rotations? I’ll leave it to you to verify if your math is correct. I get lost looking at it.

    Fov is just a number. The number of degrees in a field of vision. By default 90 maybe? I think you were thinking about something else?

    In general I made little effort to interface this plug-in with any other plug-in or other parts of construct. This was mostly for my sanity. The only plug-in it works with is sprite in that it can grab the current texture from a sprite. I may of may not have made it work with anything else such as tiledbg, 9patch, paster etc. as I recall they each stored their texture differently.

    Paster is simple to use. Just do some small tests with it. If it still doesn’t make sense then no worries.

    For text to textures you could paste the text to a paster object, then use the paster.imageUrl expression to load it into a texture.

  • It calculates the position on the screen from an xyz position. Actually I forgot to take the camera rotation into account.

    Take the xyz subtract the camera position, then multiply that by the orientation matrix.

    Xyz = (Xyz-camera.xyz)*camera.orientationMatrix

    z = z*tan(fov/2)

    ScreenX = x/z +scrollx

    ScreenY = y/z +scrolly

    Wikipedia or something would be a good source for how to multiply a vector by a matrix. Honestly you probably could use a dummy object to do all the calculations.

    Maybe:

    Set position to xyz

    Move by offset -“camera”

    Rotate by camera

    Set z to z*tan(fov/2)

    Set xy to x/z+scrollx, x/z+scrolly

    But I honestly don’t recall how the plug-in works exactly.

  • All you need is the camera position (cx,cy,cz), the fov, and the scroll position (scrollx, scrolly) apparently. Math below is adapted from the Wikipedia about 3d projection.

    screenx = (x-cx)/(z-cz)/tan(fov/2)+scrollx
    screeny = (y-cy)/(z-cz)/tan(fov/2)+scrolly

    There is no expression to get the fov so you’ll just have to remember it from when you set it.

    Not tested.

  • I opted to just have it work without flipping or mirroring. Hence the abs. One solution could be to record the sign of the width and height of the sprite into variable and apply that again when setting the sign. There may be a more compact way to do it though.

  • Sure.

    When dragging a handle it limits the motion to be along a line.

    Line equation:

    Y=slope*(x-x0)+y0

    Slope calculation uses the ratio of height to width.

    Slope = changeInY/changeInX = originalHeight/originalWidth

    The slope of the line should be negative for two of the points so I did

    (int(mid(“2002”,self.iid,1))-1)

    But either of these would be the same

    ((Self.iid=0 | self.iid=3)?1:-1)

    (int((Self.iid+1)/2)%2*2-1)

    Basically converting the index 0-3 to a negative or positive in a specified way.

    0123 -> 0110 -> 1,-1,-1,1

    The handles are laid out like this:

    0-1
     /
    2-3

    We also need to access the opposite handle to calculate the new size and position, as well as using it for x0,y0 in the line equation. In construct you can do sprite(i).x to access any instance by iid. And if we use 3-i you’ll get the opposite one:

    0123 -> 3210

    Then the new size would be the absolute value of the difference between the current handle and the opposite handle. The new position would be the midpoint.

    Finally the last event positions all the handles around the box that aren’t being dragged.

    I was trying to make it compact as possible so those iid tricks are a bit hard to read. The less terse way could look like this:

    //make a family with the handles
    
    var slope=0
    
    handle: on drag start
    pick family instance 3-handle.iid
    -- set slope to (sprite.y-family.y)/(sprite.x-family.x)
    
    handle is dragging
    pick family instance 3-handle.iid
    -- handle: set y to slope*(self.x-family.x)+family.y
    -- sprite: set size to abs(handle.x-family.x), abs(handle.y-family.y)
    -- sprite: set position to (handle.x+family.x)/2, (handle.y+family.y)/2
    
    pick handle instance 0
    handle is not dragging
    -- set pos to sprite.bboxLeft, sprite.bboxTop
    
    pick handle instance 1
    handle is not dragging
    -- set pos to sprite.bboxRight, sprite.bboxTop
    
    pick handle instance 2
    handle is not dragging
    -- set pos to sprite.bboxLeft, sprite.bboxBottom
    
    pick handle instance 3
    handle is not dragging
    -- set pos to sprite.bboxRight, sprite.bboxBottom

    It uses a family to pick the opposite handle and is more verbose about how the other handles are positioned. The slope just uses the starting size more or less. However it has a failure case if the size starts at 0,0 then the slope would be NaN. That would have to be handled.