R0J0hound's Recent Forum Activity

  • You do not have permission to view this post

  • If you made the movers slightly smaller it may help. The reasoning behind that if the collision will only be triggered once per the objects overlapping the walls.

    You could also try adding a “for each mover” to the on collision events. The reasoning for that is if the on collision condition picks all the colliding movers in one shot it could possibly need to be handled one by one but I haven’t looked at your events too closely.

    Third thought is the bullet behaviors bounce action may not be robust enough to be super reliable. But that’s just a thought

  • Try opening the browser console and see if typing that function, registerProcess, is defined.

    If it is then it likely has to do with the scope that c3 ran the script you typed. It’s probably mentioned in the manual.

  • There is a wrap behavior that kind of does that. But it’s imprecise.

    You also do the wrapping with events and make it a bit better. Here for example the screen is 640 pixels wide. It’s the most basic example and you’ll see when the objects jump from one side to the other.

    Object: x<0
    — object set x to self.x+640
    Object: x>640
    — object set x to self.x-640

    You can solve that by making the position jump further off screen by some margin. A good rule of thumb would be a margin at least as wide as the widest object you’re wrapping around.

    Object: x<-margin
    — object set x to self.x+640+margin*2
    Object: x>640+margin
    — object set x to self.x-640-margin*2

    Now that’s is the scroll position is to the left of the layout. You could make it relative to the screen if you really need to.

    For doing it with a tiled background you’d just need to have the tiled background’s width to the imageWidth+screenWidth and the events would basically be:

    tiledbg: x<imagewidth
    — tiledbg set x to self.x+imagewidth
    tiledbg: x>0
    — tiledbg set x to self.x-imagewidth

    Now if you change the x by more than the imagewidth it will take more frames for it to catch up. Adding a while condition above the x compare conditions is a simple fix. There is probably a nice math way to correct it without a loop too

  • Well I still don’t fully understand how you want it to work. I’m guessing you have a box per spawner, and you can select a box. Then clicking a button will create/ recreate the boxes that aren’t selected.

    Global number pickedBox=-1
    
    On box clicked
    — set pickedBox to box.uid
    
    On spawn_button clicked
    [negated] box: pick by uid pickedBox
    — box: destroy
    
    On spawn_button clicked
    [negated] spawner: overlaps box
    — spawned: spawn box

    If you set it up in the layout so each spawned has an overlapping box to begin with then the last two events could be merged into

    on spawn_button clicked
    [negated] box: pick by uid pickedBox
    Spawner:overlaps box
    — box: destroy
    — spawner: spawn box

    But then I wonder if we need to even recreate the boxes at all.

    Again that’s why I don’t think I fully understand fully what exactly you wanted it to do.

  • Probably load the image to an animation frame of a sprite, paste the sprite to drawing canvases the size of the frames, and finally use the drawing canvas save image feature. After that you could load those images as frames.

    An alternate idea is to just load the image into the sprite with a 2x2 mesh distort and just change the UVs of the corners to select a sub image.

    You could also use a tiledBackground by setting its size and the image offset to select a sub image. But loading images at runtime with that is per instance instead of shared between instances. Which may or may not be an issue

  • I feel it could be made simpler but I don’t understand what the desired behavior is from reading your posts.

    When the spawn_button is clicked you want to destroy any boxes that aren’t selected and create boxes on any spawners not overlapping a box? Sounds simple enough but looking at your events it looks like you have more complex behavior in mind?

  • One way is to just pick a random tile and check to see if it’s not red and is next to a red tile.

    For example with a 100x200 tilemap you’d get a random tile with:

    set x to int(random(100))

    set y to int(random(200))

    Then the rest is just comparing the tile at a location. It would need to run multiple times to select a tile to fill.

    Now a more direct way could be to loop over all the tiles and store a list of all the valid locations to an array and randomly choosing one of those.

    If you’re clever you could make it so you’d have to loop over everything only once and add and remove from the array as you go. You could try looping up flood fill algorithms to get some ideas too.

  • You said the set position action, did you mean the look at action?

    The reason you can’t set the up vector directly is it’s related to the forward and right vectors. They all have to be perpendicular from each other.

    What the look at action does is set the forward vector directly, the calculates the right vector from the forward and up vectors, and finally it calculates a new up vector from forward and right so everything is perpendicular.

    The lookat expressions I haven’t used. They seem to relate to the rotate action.

    If it jitters then I’d say post your events. All I use from the 3d camera object is the look at action which updates the up,forward and right expressions immediately.

    So I guess my untested question is do the look at expressions get updated immediately too or is it delayed till things render? Genuinely curious. I know the text.textwidth expression only updates after the text is drawn so maybe something else is happening here.

  • You can use either. It’s mostly a matter of personal preference.

  • You can check out the “user media” object. It can get a list of the connected audio input devices. You can tell if a microphone was pugged in or unplugged based on if the list changed.

    For headphones you’d probably have to do that from js to get the output devices too.

    developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices

  • It’s simple enough to do any kind of math from the event sheet.

    You can access the up vector with the 3dCamera.upX/Y/Z expressions. And only way you can modify the up vector is with the look at action.

    Can you post a screenshot of your events that set the camera? There’s apparently an official example for a fps camera that might be helpful?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound