2 questions

0 favourites
  • 8 posts
  • I have two questions:

    1) is it possible to pick an object by name only in one event? How do you create object based on name?

    2) is it possible to make the screen move at x or y according to the speed but also to the angle of the object? That is, the same as the "Scroll to" behavior but with the difference that the screen only moves when the object is at the edge of the screen. I tried to write an event but it didn't work well if the object moves diagonally it creates a flickering effect.

    I would have inserted a gif but I don't know how ...

  • 1. Not sure what you mean. If you add many objects to a family, you can pick Family member by object name. For example:

    System Pick EnemiesFamily by evaluate EnemiesFamily.objectTypeName="ZombieSprite"

    2. Try moving the first four events on your screenshot to the bottom of the event sheet. Also, you need to use delta-time, and lerp for smoother scrolling.

    So, instead of "Rocket move 5px" use "Rocket move 300*dt pixels"

    Instead of "Set scroll X to scrollX+5" use "Set scroll X to lerp(scrollX, scrollX+5, 0.4)"

    You can try different values instead of 0.4

  • By the way, your post gave me an idea to pin camera sprite to the player "rope-style". It works quite well:

    dropbox.com/s/w3bkeeqmspi913z/PinnedCamera.c3p

  • 1. Not sure what you mean. If you add many objects to a family, you can pick Family member by object name. For example:

    System Pick EnemiesFamily by evaluate EnemiesFamily.objectTypeName="ZombieSprite"

    2. Try moving the first four events on your screenshot to the bottom of the event sheet. Also, you need to use delta-time, and lerp for smoother scrolling.

    So, instead of "Rocket move 5px" use "Rocket move 300*dt pixels"

    Instead of "Set scroll X to scrollX+5" use "Set scroll X to lerp(scrollX, scrollX+5, 0.4)"

    You can try different values instead of 0.4

    1) I'm sorry, to tell the truth I completely forgot about the Family function. I mean I haven't used it yet (even though I've been using Construct for over a year). But I'll still tell you exactly what I wanted to do: The spaceship moves and collides with an object (similar to super mario cubes) so it creates the same object but a little bigger in the center of the screen which should show 1,2 or 3 other objects (which could be any objects, different from each other or the same, at this point one object stays in the center and two move one to the right and one to the left. That is, it should be an animation showing some random objects you got. So I should in a list of 20 possible objects make sure that whatever comes out, if it is the first object it stays in the center, if it is the second it moves slightly to the right, and if it is the third to the left. (to show the player the three objects in series).

    I'm trying to figure out how to write events in an easier way, I think I'll solve using "Family"

    2) I tried to do exactly as you said but (maybe I had to specify) I would like the screen to move at the same speed as the spacecraft, now it moves slower ...

    P.S. I've never used "lerp" and have no idea what that means ...

  • 1. You can create object by name in Construct3. Use "System create by name" action, for example Create "Block" & BlockNumberVariable

    Or, to create a random object you can put them all in a family and use "Create family"

    2. Check this example:

    dropbox.com/s/7lztai8wou3xyjw/PinnedCamera2.c3p

  • 1. You can create object by name in Construct3. Use "System create by name" action, for example Create "Block" & BlockNumberVariable

    Or, to create a random object you can put them all in a family and use "Create family"

    2. Check this example:

    https://www.dropbox.com/s/7lztai8wou3xyjw/PinnedCamera2.c3p?dl=0

    ok this is perfect but i have no idea how to do it ... i tried to transfer the 2 events in my program, i replaced "Player", i also changed the "viewport size" but it doesn't work for me ... also now i also have another problem that i simply can't open layouts because it gives me this message, but my driver is up to date ... would you also tell me how to fix this? In any case, the example is right is what I would like to achieve ...

    1) I already know the create object function, and I also used "Family", but I still have some problems that I can't solve: I managed to create a random object of the family group, (I created an object Object1 ((object1 is the variable name)) because: I wanted to make it so that the object could be any so I thought I'd put a list of possible random objects ... I put some images below because it's hard to explain ...

    Some I had to repeat, because for families I would like all objects to move to the right ... and then I don't know how to add the global variables I have to write add + 1 for each event ... and in any case the case shows 3 objects but all the same ...

    I know it's a mess, but I'm trying to learn ...

    In any case, thanks for your help ...

    *Events that repeat themselves

    media1.giphy.com/media/z51eqT1mpbIAdzk47d/giphy.gif

    If you want, I can insert a copy of the project, but it's a real mess ...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry, I don't understand your issue #1. If you can't use a family, use "Create object (by name)" action.

    2) For scrolling to work you only need Camera sprite with ScrollTo behavior and one action - "Camera set position ...", copy it from my project.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)