dop2000's Forum Posts

  • If you add "ID" variable to the object, you can use it to pick object instances. You can also pick by UID, IID and several dozens of other criteria.

  • You should be able to optimize at least some of the code.

    For example, if you place each Text object close to its sprite on the layout, you can do this:

    For each text 
     Pick nearest SpriteFamily -> Pin Text to SpriteFamily
    

    Or you can add an instance variable PinToUID to the Text (or TextFamily), and manually specify which sprite each text should be pinned to. Then your event will look like this:

    For each text
     Pick SpriteFamily by unique ID=Text.PinToUID -> Pin text to SpriteFamily
    

    .

    It could be even easier if you use an invisible BaseSprite as a placeholder for each group of objects.

    For each BaseSprite:
     SpriteFamily is overlapping BaseSprite -> Pin SpriteFamily to BaseSprite
     Text is overlapping BaseSprite -> Pin Text to BaseSprite
    
    
  • It's all about picking. You can first pick enemies by distance. If your event picked multiple enemies at that distance, then you pick one enemy from them by some other criteria - for example, the enemy with lowest health, or simply random. And then fight that enemy.

    RadYan is right - you have to be more specific.

  • No, sorry, you are right and I was wrong.. Wow, I always thought IID depends on the picked scope.

  • (removed, I was wrong)

  • Family is often the easiest way to work with two different instances of the same object in one event. However, since you need to copy instance variables, this means that you'll have to define those variables on the family level.

    If you don't want to do this, then you'll have to use a bunch of temporary local variables..

  • Dop2000, a different poster totally, they are not his capx files

    Oops, my apologies! This whole topic is quite confusing.

  • I thought you don't want to use collision checks? "Is Overlapping" condition in your first capx still uses them. And those events #2 and #6 from the second capx make absolutely no sense.

    If you don't want to use "On collision" or "Is overlapping" events, you can use "Pick nearest enemy to player", and/or compare distance between player and enemy and pick enemy instance within some short distance.

    Keyboard on Space pressed
     Enemy pick nearest to player.x, player.y
     distance(enemy.x, enemy.y, player.x, player.y)<20 : enemy destroy
    

    Still don't understand your problem, as in both your capx only one enemy instance is destroyed at a time.

  • You need to post your capx or at least a screenshot of your event sheet.

  • I don't know why it doesn't work for you.

    Try this demo:

    dropbox.com/s/fytd9r6f0x4l5jo/DragWithPadding.c3p

  • Yes, I meant "On drop".

    To add an image into post, use img tag, for example:

    [img=1234]

    It would be much easier to help if you could share your code or your project file.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is how I did it in my game:

    Paddle width is about 200px, origin point in its center.

    Ball has Bullet behavior, paddle doesn't have Solid behavior.

    Result looks something like this:

    Red line is the normal ball path (as when using "Bounce off solids").

    Blue line is the reflection if you use the formula from that youtube tutorial, which is not very realistic.

    Yellow line is the reflection in my game.

  • I prefer making a separate (invisible) draggable sprite.

    Say, you want to drag a small ball. Add another sprite DragBox, you can make it bigger than the ball, add Drag&Drop behavior to it. Add these events:

    DragBox is dragging -> Ball set position to (clamp(DragBox.x, ViewportLeft,ViewportRight), clamp(DragBox.y, ViewportTop,ViewportBottom))

    DragBox on Drag end -> DragBox set position to (Ball.X, Ball.Y)

    You can change clamp() parameters to limit dragging to some small area of the screen.

  • I think just "name.ext" should work. You can also try "/name.ext"

    Check that the exported file name is also in small letters (not "Name.EXT" for example)