R0J0hound's Recent Forum Activity

  • You can post your events like that, or even screenshot them for a small amount of events, but generally you’ll want to upload the entire c3p for anyone to be able to give any suggestions.

    Since the issue is with color you only need to look at the events that set the color and in turn the rgb variables. If you disable the event to cycle the colors does the rest of the colors work?

    Just a hunch, but the rgb expressions may not take the values you expect in the set color action. Some of them take values in the range of 0-100 (rgbex), and some 0-255 (rgb).

  • Setting the speed before the angle of motion like dop suggested probably will fix it.

    Why that fixes it is because when the speed is 0 trying to set the angle of motion will do nothing. That’s because the bullet behavior stores its velocity as horizontal and vertical components instead of an angle and direction. As such when speed is zero the angle of motion will always be 0. In the simple case without gravity this is all the behavior is doing if you want to try the math and get an intuition of why.

    Function setAngleOfMotion(ang)
    — set speed to distance0,0,vx,vy)
    — set vx to speed*cos(ang)
    — set vy to speed*sin(ang)
    
    Function setSpeed(speed)
    — set ang to angle(0,0,vx,vy)
    — set vx to speed*cos(ang)
    — set vy to speed*sin(ang)
    
    Every tick
    — set x to x+vx*dt
    — set y to y+vy*dt

    Anyways, all you need to know is set speed first then angle and you’ll be golden.

  • It’s always hard to debug formulas so I make them incrementally. One thing that throws setting mesh points off is if the object has an angle since points are relative to the object’s orientation. What happens if you disable the action to set the angle?

    You could simplify things by just creating the dashes at the center and just setting the points to be in a circle without setting the angle. Unless you wanted the center of the dashes to be their actual centers, then that’s fine creating them in a circle.

    Generally to set mesh points to be a location on the layout you’d subtract the object’s position from the location and divide by the object’s size to get it in mesh coordinates. If the object has an angle you’d need to rotate the point by -self.angle, so I tend to avoid that if I don’t need it.

    Var cx=320
    Var cy=240
    Var r0=200
    Var r1=215
    Var cnt=10
    Var a0=0
    Var a1=0
    
    Start of layout
    — dash: destroy
    — repeat cnt times
    — — set a0 to 360/cnt*loopindex
    — — create dash at (cx, cy)
    — — dash: set mesh size (10,2)
    — — repeat 10 times
    — — — Set a1 to a0+360/cnt*loopindex/10
    Dash: set mesh at (loopindex,0) to (cx+r0*cos(a1)-self.x)/self.width, (cy+r0*sin(a1)-self.y)/self.height
    — — — Dash: set mesh at (loopindex,1) to (cx+r1*cos(a1)-self.x)/self.width, (cy+r1*sin(a1)-self.y)/self.height

    Interestingly the gap between the dashes ends up being 360/cnt/10 or 3.6 degrees in the above example. You probably want a way to control that. If you changed the expression used to change a1 to:

    Set a1 to a0+360/cnt*loopindex/9*percent

    Then you can control the gap spacing based on the percent value.

    0.9 would be what it was before

    1 would be no gap

    0.5 would make the gap width match the dash width.

  • To open in c3 you’ll have to install versions of those plugins that were ported to c3.

    To install a plugin you either have to drag the c3addon file onto the c3 window, or go to menu->view->addon manager to install them from there.

    You’ll have to hunt to see if the plugins you need were ported from c2 to c3. Not all were, but from what I’ve seen a fair amount have been on the forum. There is even a webpage someone made that has a running list of ported plugins.

    You could also open the project in c2 and remove those plugins so you can load the project in c3 before re-adding the functionality in a c3 way. But that depends on how much you want to mess with it.

  • Construct 3 is a different license than c2. You’d have to buy a subscription to get full c3 access.

  • A looser idea could be to have the fly always moving and just gradually rotate towards a target. Since it a fly we don’t mind it overshooting the target.

    Every 0.25 seconds:
    — fly: set targetx to bag.x+random(-100,100)
    — fly: set targety to bag.y+random(-100,100)
    
    Every tick
    — fly: rotate 50*dt degrees towards (self.targetx, self.targety)
    — fly: move forward 50*dt pixels

    Another idea could be to just have the fly move forward and randomly turn left or right. To make it turn smoother you could randomly affect the amount the turning rate changes per frame instead of changing the rate directly. All that’s left is to check to see if it leaves the area and steer it back.

    Also in the same vein as the orbit behavior you could apply multiple sine behaviors to the fly to make a believable random looking motion.

  • Very cool. You’re on a roll with the updates!

    This is the kind of thing that brings life to the forums. I like seeing people creating stuff and having fun doing it.

    Any thoughts on doing some more rendering in the editor than just the box? I know the plugin is geared toward generating shapes at runtime, but even approximate shapes would help with layouting. If not users would have come up with some kind of strategy to do it I suppose. I know there are many hard limits with the plugin sdk.

    On the events side, I was able to access the points of the outer main polygon, but I may have missed how to access the points of other polygons (like holes and such). I probably just need to mess with it more as I may just have missed it.

    Anyways, keep up the good work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That said, if everything is 2d facing the camera then you could still use the perspective camera and adjust the size and position of the objects with different z so they are visually unmoving. Even some 3d stuff can be distorted to look unchanged.

    edit:

    Here's how:

    Set camera to Perspective, and add the 3dcamera object to your project.

    Then any object you to undo the perspective scaling to add three instance variables: xx, yy, and s.

    Start of layout:
    -- sprite: set xx to self.x
    -- sprite: set yy to self.y
    
    every tick
    -- sprite: set s to 1-Self.Z/3DCamera.DefaultCameraZ
    -- sprite: set scale to self.s
    -- sprite: set x to (Self.xx-scrollx)*Self.s+scrollx
    -- sprite: set y to (Self.yy-scrolly)*Self.s+scrolly

    or if you want to use arbitrary sized sprites:

    Start of layout:
    -- sprite: set xx to self.x
    -- sprite: set yy to self.y
    -- sprite: set ww to self.width
    -- sprite: set hh to self.height
    
    every tick
    -- sprite: set s to 1-Self.Z/3DCamera.DefaultCameraZ
    -- sprite: set size to (self.ww*self.s, self.hh*self.s)
    -- sprite: set x to (Self.xx-scrollx)*Self.s+scrollx
    -- sprite: set y to (Self.yy-scrolly)*Self.s+scrolly

    You just need to update xx and yy whenever you move the sprite.

  • It seems to be a bug. Made a simple c3p with an ortho camera that alternates the scaling mode and found the bigger the window the more it zooms with low quality. Can't find a way to compensate since you can't set the layout/layer scale with a ortho camera.

    dropbox.com/scl/fi/a0dhqhrhgkla73jruvowx/ortho_camera_low_high_fullscreen_scaling_bug.c3p

  • You could look into hierarchies, and just set the child/parent relationship with an action when you create child objects. Then drawing lines would be simple as looping over children, picking parent, and drawing lines. It supposedly would look like this:

    start of layout
    -- create pup at (100,100)
    -- adult: add child: pup
    
    every tick
    -- canvas: clear to rgb(0,0,0,0)
    
    for each pup
    pup: pick own parent adult
    -- canvas: draw line from (pup.x, pup.y) to (adult.x, adult.y)

    If you don't need the positioning that hierarchies provide you could use a "parent" variable on the child objects. Make the default value of that instance variable -1. That would look like this:

    start of layout
    -- create pup at (100,100)
    -- pup: set parent to adult.uid
    
    every tick
    -- canvas: clear to rgb(0,0,0,0)
    
    for each pup
    adult: pick by uid: pup.parent
    -- canvas: draw line from (pup.x, pup.y) to (adult.x, adult.y)

    Either way would be fine as long as the parent and child sprites were not the same type or family.

    If you wanted the parent and child to be the same type or family then it would be tricker. In general that type of thing is trickier with the picking system, but one strategy is to pick one, save values to variables, then pick the other.

    For example, if you had a family "dog" with types ("pup", and "adult"), and the family had an instance variable "parent" with a default value of -1.

    start of layout
    -- create pup at (100,100)
    -- pup: set parent to adult.uid
    
    every tick
    -- canvas: clear to rgb(0,0,0,0)
    
    var puid=-1
    var x=0
    var y=0
    
    for each dog
    -- set x to dog.x
    -- set y to dog.y
    -- set puid to dog.parent
    -- pick all dog
    -- pick dog by uid puid
    -- -- canvas: draw line from (x, y) to (dog.x, dog.y)

    Observe that the last event should have a sub-event starting with "pick all" (sub-events are harder to depict with text).

    Anyways, just some ideas.

  • So the drawing of the lines between the children and parents is what you’re having issues with?

    Sounds as simple as looping over each object and if it has a parent, draw a line between the two object positions.

    Or are you having issues of a different part of it?

  • So I had a go at trying to distort a mesh to give collisions that match the polygons and it works pretty well. I'm not sure if juggling a separate object from a different plugin is feasible though.

    dropbox.com/scl/fi/9ynvheoi016450691vt86/poly_plugin_collisions.c3p

    It only works with the exterior polygon though. Unless there is a easy way to merge the holes with the outside so it's one polygon like this:

    Anyways, some feedback:

    Maybe you could make the Polygon.PointWorldX expression work with numbers as well as strings? I had to use Polygon.PointWorldX(str(loopindex)) instead of Polygon.PointWorldX(loopindex) to access point locations. Nothing major, but thought I'd bring it up.

    I see that you can set the scale of an svg when you load it, but are there any plans to be able to scale polygons after they are created?

    Other than that, pretty cool plugin.