R0J0hound's Forum Posts

  • You can use the .asJSON expression and the "load from json" action to copy one object to another. For example if you want to create a Sprite that is a copy of the Sprite with a uid of 2 you could do the following.

    Global text template=""

    On click

    Pick Sprite by uid 2

    --- set template to Sprite.asJSON

    --- create Sprite at (0,0)

    --- Sprite: load from json template

    --- Sprite: set position to (mouse.x, mouse.y)

  • You could use a variable to temporarily store the current group as you loop over the passages you're overlapping like this:

    global number curGroup=0

    finn: overlaps passage

    for each passage

    --->set curGroup to passage.group

    --- pick all passage

    --- passage: group = curGroup

    ------> passage: set opacity to 50

  • Look at blend modes, with them you can do masks which is similar to the effect in the link. There is a blend mode example that comes with C2.

    A simple how to would be:

    Add a layer

    Set it's property "force own texture" to true.

    Add a Sprite to that layer that you want to display.

    Add a second Sprite for your erase mask. Set it's blend mode to destination out.

    Now the second Sprite erases from the first where they overlap.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's pretty cool. The art gives it a lot of polish.

  • Maybe ask the people who said they hate Nintendo. I wasn't aware anyone on this forum did.

  • The uid is unique per object. You can find what a created object's uid is with the .uid expression of the object. The new object is picked for the rest of that event or until another create action.

    Every 1 seconds

    --- create: Sprite at (random(100),random(100))

    --- text: set text to Sprite.uid

  • If you want to create an object by name this plugin will help:

    Personally though i'd either just add a event per type to create it or put them all into animations.

  • [quote:3mkuwc53]EDIT : I was able to resolve this - Pasted a color palette image onto canvas. But after pasting the image, I lost some resolution of the palette...does the canvas paste use a color loss/reduction algorithm?

    It doesn't but I have seen the color loss too. No idea how to correct it.

  • Either of the following would work. Either you just specify what way you want the object to do when you create it, or you can pick it by "pick nth instance" or "pick by uid" or something.

    Start of layout:
    --- create: ball at (random(320),random(480))
    --- ball: set angle to 0
    --- create: ball at (random(320,640),random(480))
    --- ball: set angle to 180
    
    every tick:
    --- ball: move forward 100*dt pixels[/code:26fx4ael]
    
    [code:26fx4ael]Start of layout:
    --- ball: destroy
    --- create: ball at (random(320),random(480))
    --- create: ball at (random(320,640),random(480))
    
    system: pick 0 instance of ball
    --- ball: set x to self.x+100*dt
    
    system: pick 1 instance of ball
    --- ball: set x to self.x-100*dt[/code:26fx4ael]
  • edit: ninja'd

    Where did you read that? There's nothing amiss with using multiple event sheets.

    As to the op, you could just use a sprite and add instance variables to that. It could be any object really, and if you make it a global object you can make it live on to other layouts.

  • I'm not the dev but here's a quick explanation of what is happening. The behavior doesn't store the angle of motion and speed, instead it stores the horizontal and vertical velocities and calculates speed and angle of motion from them. So when the speed is 0 the velocities are (0, 0) which results in an angle of motion calculated as:

    angleOfMotion = angle(0,0, horizontalVelocity, verticalVelocity) = angle(0,0,0,0) = 0

    That's why whenever the speed is 0 the angle of motion becomes 0. which happens in your capx when you set the speed to iaccelerate, which is zero at the start of the layout and after hitting a wall.

    Anyway's while waiting for an official response you could reproduce the bullet behavior with events. It's rather simple and we can make it keep the angle of motion even when the speed is zero.

    1. add two variables to your object of choice (character for instance), and call them "speed" and "angleOfMotion".

    2. add an event like the following and put it toward the top of your event sheet. basically jut use the "move at angle" action.

    every tick
    --- character: move self.speed*dt pixels at self.angleOfMotion degrees[/code:zts93hcr]
    
    And that's pretty much it.
  • True, and no they don't auto complete from expressions. If you change it I guess the easiest current way would be to search for the old name and then replace every occurrence with the new name. Another idea I've seen others use is make a constant global that they set to the layer name, then whenever referencing the layer with events just use the constant. That way if you rename the layer you only have to change the name in the constant, and in turn you could rename the constant.

  • Well let's test if the container indeed isn't working. We can do this by temporarily disabling the events. Disable all those events in your photo except for the first one (sentryEye: selectOrMove="select"). Next disable all the actions in that event and then add some simple action to see if the objects are indeed being picked. Something like this will work:

    sentryEye: selectOrMove="select"

    --- SentryEye: rotate clockwise by 1 degree

    --- Scout: set opacity to 50

    --- SentryEyeDot: move forward by 1 pixel

    or alternatively instead of adding those actions, enable all that event's actions except the one that changes selectOrMove.

    With that you should be able to verify if the container is working or not. Ideally you'd have multiple instances.

    If it doesn't work at all, then take a look at the value of selectOrMove in the editor. Is it "select"? Beware of case sensitivity.

    EDIT:

    if all else fails post or pm me the capx and I can find exactly what's amiss. First I'd look at the variables, next I'd look for other events that modify selectOrMove and finally I'd disable most of the events (like above) and enable them a bit at a time and verify they're doing what you intend.

  • I guess it's time for some debugging. There's probably some logic error somewhere.

    You can either look at the variables in the debugger to get an idea what's up or add some events to display the variable values at various points.

    Since the events in the photo look fine the problem could be elsewhere. Do those objects start with a value of "move" or "select"? If they do are they all lowercase? If that looks good then do those variables get set anywhere else in your events?

  • I agree those would be useful additions, but if you want to get them now you can do this:

    global text tilesJSON=""
    global number horizontalTiles=0
    global number verticalTiles=0
    
    Start of layout
    --- set tilesJSON to tilemap.tilesJSON
    --- set horizontalTiles to int(mid(tokenat(tilesJSON, 4, """"), 1,20))
    --- set verticalTiles to int(mid(tokenat(tilesJSON, 6, """"), 1,20))[/code:ixdzkbtt]