dop2000's Recent Forum Activity

  • You can make a grid with square sprites and use "Pick nearest" to find the nearest cell.

    Or use a tilemap, it has SnapX and SnapY expressions.

    Or you can do it with math. Say your grid cells are 10*10px. And player drops a piece at x=77, y=22

    Use these formulas to find the nearest cell:

    nearestX = (round(x/10)*10)=80

    nearestY = (round(y/10)*10)=20

    Once you know the destination coordinates, you can move your piece there using a behavior like MoveTo or LiteTween.

    Or without any behaviors:

    On every tick

    Piece set x to lerp(piece.x, destinationX, dt*4)

    Piece set y to lerp(piece.y, destinationY, dt*4)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can try a trick with a family.

    Create a family with sprite A.

    Then use "FamilyA spawn A"

    "A.UID" in this event will refer to UID of a newly spawned instance.

    Or you can use "System->Create" action:

    Function call "CreateNewA" (A.x, A.y)
    
    On function "CreateNewA" 
       System-> create new A on layer 0 at (function.param(0), function.param(1))
       A set instance variable ....
    [/code:1kr5a5k7]
  • I noticed that "Destination out" blend mode with "Force own textures=yes" set on the layer costs about 10-15 fps in performance drop on my older mobile phone.

    I'm going to disable this blend mode on slower devices and use an alternative (less nice looking) effect.

    So I have 2 questions:

    1. What's the best way to measure performance? I'm thinking when the level starts, collect fps on every tick for about 5 seconds, then calculate the average fps. If average fps<30, then disable blend mode.

    Is there a better or more reliable way?

    2. Is is possible to get masking effect without the "Force own textures" setting?

  • What do you mean by "spawned by itself"?

    If you have sprite A which spawns sprite B, you don't need to know B.UID, you can simply do this:

    A spawn B

    B set instance variable ....

  • Create another variable "oldX"

    If X not equal oldX -> Set oldX to X; and do other stuff you need to do

  • CreativeMind

    Could you share you code please? I'm making a simple Arkanoid game and would also like to adjust ball angle depending on paddle speed. I'm using Bullet behavior with "Bounce off solids=yes".

  • It's probably because you are restarting it in your first layout.

    Add a condition "If NOT Audio tag 'music' is playing", so that the music wouldn't restart if it's already playing.

  • Looks ok, but change the names - the sprite should be named Wolf and the family should be Enemies.

    Do the same with Player and NPC, add them to Friendlies or Allies family. But only move instance variables and behaviors that both Player and NPC have (and future allies will have). For example move Mana and Health to the family, but ScrollTo behavior should remain at Player sprite.

    After you do that, you should be able to remove the whole WolfAttackNPC group and maybe optimize lots of other events in your project.

  • Containers are useful for objects that exist together. For example - Enemy, EnemyShadow, EnemyHealthBar.

    They save you a hassle of creating/destroying each object separately.

    Also, all three instances of these objects are logically linked. So when you pick one enemy in an event, you can refer to its shadow and health bar in the same event without the need to pick them by EnemyID.

    No, replacing "wolf" sprite with "wolf" family makes no sense... Will wolf be the only enemy type in your game? I guess not. So your family should be called Enemies. And your wolf sprite should be called Wolf. If you add Bear, Goblin etc, you add them to the Enemies family and they will inherit all Enemies instance variables and behaviors.

    Have you followed that tutorial and moved wolf's instance variables and behaviors to the family level?

  • This should work:

    Door overlapping Ground
        System-> Pick 0th Ground instance  :  Door Set room1=Ground.room
        System-> Pick 1th Ground instance  :  Door Set room2=Ground.room
    [/code:mbk8dw2f]
    
    You can also use Ground.pickedCount expression to check how many Ground instances are picked in this event.
  • Timer would be a better option. You can pause/stop the Timer if needed, which you can't do with Wait.

  • A few other thoughts -

    5. You can get rid of all range circles (PlayerRange, AttackRange, NoticeRange).

    Use instance variables and distance() expression instead.

    PIck Enemies if distance(Enemies.x, Enemies.y, Player.x, Player.y)<=Player.attackRange

    will pick all Enemies within the attack range from the player.

    6. Name your layers correctly and use layer names instead of numbers. If later you have to add another layer between 0 and 1, you'll not need to change layer number in all events.

    7. Use constants instead of "magic numbers".

    E.g. NoticeRange=MAX_NOTICE_RANGE, instead of NoticeRange=600

    See this post for more useful tips:

dop2000's avatar

dop2000

Member since 26 May, 2016

Twitter
dop2000 has 250 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
  • x4
    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