R0J0hound's Recent Forum Activity

  • You could move them toward each other if the distance is greater than 300.

    Roughly this. Distance-300 would be the extra distance beyond 300, and you’d divide it be two so each object goes half that.

    Var dist=0
    Every tick 
    — set dist to distance(a.x,a.y,b.x,b.y)
    
    Dist>300
    — a: move (dist-300)/2 pixels at angle angle(a.x,a.y,b.x,b.y)
    — b: move (dist-300)/2 pixels at angle angle(b.x,b.y,a.x,a.y)
  • It should be the same.

  • Well in construct the red dot is at angle 0 from the center of the needle. You can then use the anglediff() expression to get the difference between two angles. And to make it -20 at five just multiply by -4

    Volume =-4* anglediff(0, needle.angle)

    Or if you just want to use the position of the red dot instead of an angle

    Volume = -4*anglediff(angle(needle.x,needle.y,red.x,red.y), needle.angle)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's another iteration that puts the anchor points at the corners instead of the sides. It also keeps track of where anchors are in a dictionary so it avoids putting markers on attached objects and avoids duplicate markers. Still only 10 events, but I'm sure it's possible to simplify further so you have more than 15 events to use if you use the free version.

    Anyways some more ideas maybe.

    dropbox.com/scl/fi/g7fcdn16o3z7e4flss33y/dynamic_attaching2.capx

  • This was made before you posted your last few posts but maybe you can get some ideas from it.

    Roughly it just creates attachment points around all the attached objects, and then deletes invalid points that overlap other attached objects.

    It keeps track of what's attached with a boolean variable and doesn't let moving objects get attached so you can throw them. Also it keeps track of the order the objects are added with a number variable.

    dropbox.com/scl/fi/7vf4eia7vzvmnzd8hoi6g/dynamic_attaching.capx

  • An image illustrating what you’re after often helps if you can’t describe it enough to get the idea across.

    I get that you want to be able to attach multiple instances to each point now but you probably need to be more specific about what you want to happen when there are multiple on one point. Should they stack? Should they all not overlap but be close to the point, like in a circle? Or since you said bigger maybe you want them to overlap and scale up based on how many are attached?

    As to the statements about confusion and weird with how your attempts are running I’d recommend sharing a c3p or a screenshot of your events. Typically there is no way to debug things based on descriptions otherwise. But if you meant them as just vents in frustration I can understand that too.

  • If you are utilizing a translator then it has made your question confusing.

    I can’t read the language in the picture so here is your events written with “white”, “grey” and “variable” instead of your language.

    For each white
    Trigger once
    White overlaps grey
    — white: destroy
    — white: set variable to 1
    — white overlaps grey
    — — white: destroy
    
    Every tick
    White: variable=1
    — white: destroy

    Instead of all that, wouldn’t this work to destroy white when it overlaps grey?

    white: overlaps grey
    — destroy white

    But maybe you’re trying to do something else. Also, I should point out that you probably never want to use “trigger once” in a loop.

  • You do not have permission to view this post

  • Can’t test but you can look at it in the debugger. If you position the sprite at instance 0 and set the instance variable n to 0 then it should be there.

  • When it’s under a sub-event you run into how newly created objects aren’t available for general picking till the end of the current event tree. Search the forum about “toplevel events” to find many explanations about it.

    Anyways what’s happening is the p sprites are created but aren’t pickable the first time the every tick is run. At that point there is likely 0 pickable instances so you get a nan.

    Quick fix? Don’t make the every tick a sub-event, and instead just add the variable compare condition to it.

  • Basically if two adjacent points of the path are at the same location then the formula will become 0/0 which equals NaN.

    So make sure the path has at least two points and there are no two adjacent points that are at the same location. That should prevent it.

    But say there are cases when the path has less than two points temporarily. You’d fix it by setting the sprite you’re dragging’s position after creating all the points or just don’t update the position if t is nan or if p.count<2.

  • As is the p(n).x expression doesn’t deal with picking at all.

    You could do an object type per path and duplicate the event. Or just have one type with all the paths where you’d pick the path you want and create p sprites on them. Or you could store the points in an array and do array lookups instead of accessing the nth instance.

    You could stick with one type and consider a range of iids for each path. That would require some logic to loop the indexes in the range.

    You could also break the formula apart to be longer and more verbose using variables. Then you could mark the p instances with a path id. You’d pick the instances with a certain id then use pick nth instance for the two points and set variables from each.

    Anyways just some ideas.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound