R0J0hound's Recent Forum Activity

  • If no instances of an object are picked then all it’s expressions default to 0.

    What should happen is in event 48 the just created instance is picked. Then in 49 all the instances should be pickable like normal. But looks like none of the token instances are picked in 49, hence getting the zero.

    Looks like a bug. If the event were not in a group then 49 would have all the token instances picked. Groups shouldn’t affect that.

    At one point events in groups were considered sub-events. There was then a change so they would all be top level events so new object picking would work. If that’s no longer the case it appears to be a bug.

    EDIT:

    Got around to testing this. Can't reproduce. The token.count or things not being able to be picked.

  • There isn't a loop. Here's a specific example. It passes the filtered sprites via an instance boolean. The function is called once.

    every tick:
    --- sprite: set picked to false
    
    sprite: x>100
    sprite: x<200
    --- sprite: set picked to true
    --- function call "foo" ()
    
    on function "foo"
    sprite: is picked
    --- sprite: rotate 100*dt degrees clockwise

    The uid and loop way to do the same thing. The function is called once per instance. Any if you want to pass a newly created instance you're pretty much forced to use this way.

    sprite: x>100
    sprite: x<200
    for each sprite
    --- function call "foo" (sprite.uid)
    
    on function "foo"
    sprite: pick by uid function.param(0)
    --- sprite: rotate 100*dt degrees clockwise

    With such a simple example it's irrelevant which way to use. I can see the value of being able to pass what's been picked, but that's pretty much a valid way to do it. Functions only pass values for the foreseeable future from what I can tell.

  • You can avoid a loop by setting an boolean instance variable that can be used to pick the objects in a function. A caveat is you have to set the boolean to false for everything first.

    every tick
    --- sprite: set picked to false
    
    some conditions to pick a certain group of sprites
    --- sprite: set picked to true
    --- function call "foo"
    
    on function "foo"
    sprite: is picked
    --- do something
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One is made in that range because it’s easier to think in 0 to 360, and the other is because the angle calculation from linear velocity using atan2 gives that range.

    Typically it doesn’t matter what you set the angle to. If you want to know when an angle is close to a certain angle don’t compare it’s value directly. There are angle compare conditions that handle the cyclic nature of angles for you.

    If you need to rely on a certain numeric value for an angle then you can clamp the value in some way first.

    0-360

    ((A%360)+360)%360

  • This topic seems close to what you’re after. There are a few examples and ideas.

    construct.net/en/forum/construct-2/how-do-i-18/moving-character-leftright-144643

    A Bézier curve would be done by converting it to a bunch of lines.

  • You can make it stop by making t stop increasing. Here’s one way to do it.

    Every tick

    — set t to min(t+dt, 1)

    — set x to lerp(50, 500, t)

  • AllanR thanks, there are probably pros and cons of either way. I see in that other topic you did a redo too, which is pretty slick.

    Alon

    The example was mainly to try out various ideas. On one hand it’s a control scheme that I did for fun and the other part is a way to do undo. It was mainly to maybe give ideas, the bulk of it would be much different with different setups.

    The main contribution was to use a id variable instead of uid.

    Anyways the undo system is simply this in a nutshell. Right before modifying stuff save it to a list somewhere. Then when you want to undo, you take that list to restore how things were.

    My events do tend to be pretty dense and admittedly I use lots of tricks to make things more compact or make some things simpler. Tricks are mainly:

    Using text as a list and using tokenat to get values.

    Using pick by uid to get around picking a newly created instance.

    Using groups to scope away some variables to keep things a bit more organized.

    I also don’t use c3 but the way to call functions is just different but can be used in the same way.

    Probably the simplest way to do save as a beginner is to just save/load state I guess.

  • I did a test of an undo system with some editor I came up with.

    uc8bef7b4119ea02663c37b115dc.dl.dropboxusercontent.com/cd/0/get/Ch4q9iD0l0nSpoUvWe0fCgg-p8-zVfamVsjCSEP5BXHWcxWyVP6lB2zRmzKTZxUs2ejr-unXbPCgY1YS4eJaNVM1J2yL24FkeWNAbtXpDp3LjdhdaTW0wAXOunBONUXm4_KqXEHwNQ_X-vVRYO__78xD/file

    Here are some thoughts.

    * For doing undo with creating/deleting sprites it works fairly well to do your own id system instead of using uid's. Basically a global variable nextID that you assign to an instance variable id, and increment every time you create an object.

    * Here I saved the id,x,y and angle of all the selected objects for every undo point. You could go more compact by just saving a list of ids and a change in position or angle for things like moving and rotating.

    * you could also merge consecutive move or rotate undo points as a way to make stuff more compact. It would depend on how you want editing done though.

  • Instead of the repeat you could use an infinite while with a condition at the end to stop the loop. Isn’t that the same as a do..while?

    While

    — do stuff

    — system:compare found=1

    ——stop loop

  • That’s the one. Not sure the extent of how much it stops the antialiasing. If the c2 project setting uses linear filtering then the canvas will get blurry if it’s scaled or if the window is scaled. Basically a pixel on the canvas needs to be the same size as a pixel on the view.

    Worst case you could draw the shapes directly a pixel at a time to get crisp edges. Again that would depend on scaling to some extent.

  • dop2000

    There is a property in html5 canvases to disable/enable that smoothing. Its not exposed to the plugin though and when I looked last it’s something that wasn’t universally supported across browsers.

  • It’s probably a throwback to how arrays were separate objects in Clickteam products.

    Also it does help keep things tidy to have the array actions and conditions grouped together. At least with how types are handled currently.

    Construct classic actually had a way to assign arrays to variables, although they were pretty much constant. You couldn’t change the size or elements of it, and it wasn’t supported in all places. The feature didn’t make the jump to C2.

    I think it would nice be have as a variable type though. If it made the array object obsolete I wouldn’t mind, as soon as you do something moderately complex that involves picking you realize containers don’t really help a lot.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 156 followers

Connect with R0J0hound