R0J0hound's Recent Forum Activity

  • Try it without the wait. Loopindex isn’t preserved when using a wait.

  • Just use loopindex not loopindex(“”)

  • Yeah I was thinking collisions could be an issue but it should mostly work. But yeah the velocity bit is probably problematic. You could also cancel the part of the velocity of the objects moving away from each other.

    Here’s one way to do that. You’d do this in addition to correcting the position in my other post. Relv is the velocity of the objects moving toward or away from each other. Then you’d subtract that from the velocity’s so it just keeps the rest of the velocity.

    Ang=angle(a.x,a.y,b.x,b.y)

    Relv= (a.vx-b.vx)*cos(ang)+(a.vy-b.vy)*sin(ang)

    A: set vx to a.vx-relv*cos(ang)

    A: set vy to a.vy-relv*sin(ang)

    … same for b

    Overall setting the position is nice in that it provides a hard limit to how far objects can move apart. Adding a velocity correction to that helps.

    Just changing the velocity to limit the positions indirectly is another idea for sure. It’s actually what the physics behavior does to resolve collisions and joints. In practice it can be a bit spongier though. A quick way is to apply an acceleration to the objects toward each other if too far apart which is a bit spongy. Another idea is to just do the velocity correction above. Probably only if the relv>0 or moving apart. However you’ll still need to add a bit more velocity to move the objects back toward each other otherwise they will drift apart

  • 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)

  • 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.

  • 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