dop2000's Recent Forum Activity

  • You probably need to store current scale value in an instance variable on the sprite. And use that variable instead of the fixed "0.5" number.

    Ship set scale to clamp(Ship.curScale+(Touch.X-ScaleX)*0.0090, 0.3, 1.5)

    When resizing is finished, save the new scale value to curScale variable.

    0.3 and 1.5 are the minimum and maximum values for the clamp() expression. See the official manual:

    construct.net/en/make-games/manuals/construct-3/system-reference/system-expressions

  • There is no bug. The engine needs to know which instance you want to compare, that's why you need to pick the correct instance. If you don't pick, then the first available instance is used and the result may be different from what you expect.

  • I don't understand why the family solution is not working for you. If you disable all other events you can see that it works fine:

    In this case the "Is overlapping" condition picks two instances - one Sprite1 and one Family. This allows to compare their frames.

    However, if more than two instances are overlapping, the event may not work. You will need to do more picking to select two specific instances for comparing.

  • Here is an example, but it may not be suited for your purpose because Physics is disabled during dragging. Which means that the object will not collide with other physics objects while you drag it.

    howtoconstructdemos.com/throw-a-physics-object

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Press F12 in the preview window and check for errors in the console log.

  • It's still not working, What I'm doing wrong?

    You are not picking the right instances.

    Before you do anything with instances in Construct you need to pick them. Otherwise the engine doesn't know which instances you need. Imagine you have 1000 instances of Sprite1. Which ones the engine should select to compare their animation frames? Which ones should become visible?

    Picking is possibly the most important concept in Construct. I suggest you start by reading the official documentation and studying some tutorials.

    .

    The result showed that construct3 has a problem with comparing objects to themselves.

    igortyhon I don't see any problem in your example. The condition "Sprite1.AnimationFrame=Sprite1.AnimationFrame" is always true, which is expected.

  • anglediff but not sure how it will work when one value becomes negative

    Anglediff will work just fine.

    You can convert an angle to positive number using this formula: (angle+360)%360

    The result will be between 0 and 360. But I still recommend using special System conditions which are designed for working with angles.

  • suppose if I want to check whether both values are 185 or not. selfangle will show 185 but angletoplayer will show negative value when its supposed to be 185

    This is not a good idea, because the angle may not be exactly 185 degrees, it may be 184.999999999998 or something like that. So even if both angles are positive values, I still don't recommend comparing them directly.

    Use System conditions, for example "angleA Is within 0.5 degrees of 185". This will work with any angle values positive or negative, and will account for any rounding errors.

    Another option is to use anglediff expression:

    anglediff(angleA, 185)<0.5

  • With two instances of a sprite, but each instance having different frames.

    You can't compare two instances like that! When you use an object in an expression like that, only the first instance is checked. So you are comparing it with itself.

    If you want to compare two instances, you need to pick each instance separately. With a single object it's tricky, a common workaround is to use a family. Then you pick 1 instance of the sprite and 1 instance of the family, and compare Sprite.animationFrame=Family.animationFrame

    Another option is to use IIDs:

    Sprite(0).animationFrame=Sprite(1).animationFrame

    But you need to be sure that there are only two instances on the layout.

  • Use an instance variable - once the sprite is spawned, set a value in the variable. Check that this value is not set before spawning.

    Another option is to add the child sprite to a hierarchy. Check that the parent sprite has no children before spawning.

  • but after 180 angletoplayer variable becomes negative

    It doesn't matter if you use special conditions which deal with angles - like "Is between angles", "Is within angle".

    Also, you should use delta-time if you need to rotate or move characters with events. Replace "rotate 1 degrees" with "rotate 60*dt" degrees.

  • You can use angle() expression and "Is within angle" condition.

    For each enemy
    System enemy.angle is within 20 degrees from angle(enemy.x, enemy.y, player.x, player.y)
    ... Enemy spawn bullet
    
dop2000's avatar

dop2000

Member since 26 May, 2016

Twitter
dop2000 has 256 followers

Connect with dop2000

Trophy Case

  • 8-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • x5
    Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • x3
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x13
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

28/44
How to earn trophies