R0J0hound's Recent Forum Activity

  • I mean there aren’t that many 3d features available in construct so trying to do anything beyond the obvious features will be more involved if possible at all.

    For example even throwing a tomato in 3d becomes an involved multi part problem. Construct doesn’t really provide anything that would make it easier.

    1. The tomato would need to be a sprite or a mesh. If a sprite you’d probably want to use a distort mesh so that you can have the sprite always face the camera. But only if the camera is set with the look at action. The camera rotate action makes it harder. Then if 3d there’s the problem of the limited number of 3d shapes. For that you’d either need a third party 3d plug-in, or do some trickery with distort meshes.

    2. To move the tomato we’d need to do the physics from scratch. None of the behaviors will help here.

    Off the top of my head the motion and basic ground plane collision detection would be this:

    Every tick
    — add gravity*dt to vz
    — set x to self.x+vx*dt
    — set y to self.y+vy*dt
    — set z to self.z+vz*dt
    
    Z<0
    — destroy

    To launch you’d set the starting z position, then set the velocity (vx,vy,vz) to the camera’s forward vector times some speed.

    Anyways as you can see there is math involved. And the names of things are different in construct. Like zelevation instead of z. Plus you’ll want to set the project z scale from normalized to regular.

    I know an example would be ideal but I feel like I’m re figuring out how to do it every time. As is it’s hard to just drop an answer without an example and have it be clear how to implement that into construct.

  • If you add a variable t to the pillar then you could do something like this:

    On bullet collides with pillar
    — pillar: set t to 0.5
    
    Pillar: t<=0
    — pillar: set y to self.y-50*dt
    
    Pillar: t>0
    — pillar: subtract dt from t
    — pillar: set y to self.y+75*dt

    With that it will go up at 50 pixels per second. Once it gets hit it will go down at 75pixels per second for 0.5 seconds. You can change all the values.

  • I agree it would be tedious to make the collision shape manually and it would be hard to get it to be smooth.

    But you can use mesh distort to make any shape you want. For example this takes a square sprite and makes it into a circle. Even with just 20 points it's decently smooth. Typically you'd make that invisible and put the sprite you want for a visual on top.

    uca777cd3792ee6da2dbba83734e.dl.dropboxusercontent.com/cd/0/get/Ch4umLpVZjsrbzqCUvMOono6NnM53jQjUiA2UOBgH4FsnSbZHqUPeoX2JJiorhXz6e-JtyOjcyDFDqTvscUqaojx9LyxQq_7F_jNxdUjNjsDmYyhU9fK9WSJMREdFvCxfy4kXkFaMXrWA3Pl4PLR65uZ/file

    The second part of that example loads the outline of a mario sprite.

    You can use this tool to create the point list.

    uc588c13e6f678307ee7fc56ae49.dl.dropboxusercontent.com/cd/0/get/Ch6hcZ6ckeMZA2fjk-h9tc87X95yynlYj2W9GG50ZYPYqV21vKfpHqBqBx1Fm6TTO2m67TOOedQ_LQB01xgITDGSuUwLr8RBFCKtlPSxl6pRmZk6jXyw-m1E-QWZiECx7fMsTjXDhJhRUFGdh-s1nHoY/file

  • Guess it’s better than nothing. My main complaint is its solution didn’t give something working. You had to modify it a lot.

    At least the formula was probably useful. It basically is a way to move by an angle and it is one of the main uses of trigonometry for games. But then again construct has the move at angle action which could be used instead of the math.

    The problem I see with more complex problems is having to see if the solution is correct. If you have to modify it heavily like removing the angleToRadians expression and such then it’s not helpful.

    But I can see the value of it giving some ideas of where to maybe start.

  • It won’t affect performance one way or another. Using something else is just to organize things.

  • By default the color components go from 0-100 not 0-255.

    Use (0, 100, 102/255*100)

    Or use one of the other rgb expressions that take values 0 to 255.

  • In construct 3 if you make the function return a value it won’t show up in actions but it will show up in expressions.

  • Functions are simply a way to re-use chunks of events. They are only run when you call the function.

    Triggers can be thought of as functions. If it helps some things like input are probably checked regularly like non triggers but that check is done at some lower level point in the system. Like mouse clicks are checked in the mouse driver, which is taken by the operating system, sent to the browser, which loops over the events and sends them to the js event listeners, which in turn is handled by construct’s engine.

    Other triggers come from checks in other places. For example on frame changed comes from the sprite objects tick function which updates the frames. There it calls the trigger when the frame changes.

    Some things are so called fake triggers, but that’s mainly a term in the sdk. There aren’t too many examples of them, off the top of my head on collision, gamepad triggers, timer triggers, and I want to say in the Los behavior. It’s more of an exemption to the rule, and they act like a normal event with a trigger once.

    In collision is interesting since it’s both a fake trigger and a real one. It’s kind of like an is overlapping and a trigger once but it’s done per instance It’s also a normal trigger because the physics behavior calls it when the physics engine has a collision.

    Anyways, functions are just a way to organize and reuse code.

    In general you can think of triggers as functions that don’t run every tick, and instead are called by other parts of the runtime. But like many parts of the engine there are exemptions where things may work differently.

  • Sprites are not dom elements so they can't have js events such as mouseenter added to them. But either way to logic is the same: all the sprites would need to be checked to see if the mouse is overlapping them every frame, unless there is some spatial partitioning done behind the scenes.

    Anyways, simpler is often better (and faster) with events. Like others have stated you can do this which will will access all the sprites twice per frame. You'll run into other performance issues with a high number of instances in other ways before this is an issue.

    every tick -> sprite: set highlight to false
    mouse over sprite -> sprite: set highlight to true

    You can reduce it to accessing all the instances only once per frame with logic like this:

    var prevUid=-1
    
    sprite: pick by uid prevUID
    -- set highlight to false
    -- set prevUid to -1
    
    mouse over sprite
    -- sprite: set highlight to true
    -- set prevUid to sprite.uid

    The final idea is to use some kind of spatial partitioning which could in theory reduce the number of instances to check to one per frame. For example here is a grid hash idea.

    uc0eca2484bb6c52689373884ed2.dl.dropboxusercontent.com/cd/0/get/Ch63sklvxlPHHcyoqi07EpWQKAxiBbVTS7sO1Wa7vyyXCprvQVPCde-GM_2h4TAyr6u0hCeqtilWcme6L0PgPL86PMlpvdutnnXcqR8zmoCd762YtrDNjkrWn-ZL18WKTSSZYFPGLz9JiLR5cYEG_van/file

  • Reuploaded again in case I didn't remember to do it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Testing more you'll need to add 0.5 if the origin is centered:

    (x-self.x)/self.width+0.5

    (y-self.y)/self.height+0.5

    If the origin is top left it would be 0,0

    Also here's an example if you want to work with rotation: uc92867447d5846de204c834b9c0.dl.dropboxusercontent.com/cd/0/get/CiBd2ZNAYMxGJvXkWyTj9xui5_T_Um3fFQdWSCFpjSGjYoA3JhK9NeBvJPwayNxYtF0viXfhIcV6dchfClZOnZvPI094KspOM1rlOShFEXi00ZkWCU6Ps7ydt0JbVAAe8oi4xGa54hf_-kdE9JP8ioI4/file

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound