dop2000's Recent Forum Activity

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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:

  • Your game looks great!

    However, it seems like it's going to be a big project and it's already quite messy. You need to get a few things right ASAP!

    1. First, start using families. I imagine wolf will not be the only enemy in your game. You don't want to duplicate hundreds of lines of your code when you add a new enemy type!

    Create families for all objects that can be logically combined - Enemies (include wolf, bear, zombie etc.), Friendlies (Player, NPC), SceneryObjects etc.

    Every time you add new events and feel like you may need to re-use them for a different object, consider creating a family.

    Note, that you can have the same object in several families.

    Say, wolves can be in Enemies family for all enemy-related things (attacking, pathfinding etc.) and in AliveObjects family (vulnerable to cold, leave blood splatter when killed etc.).

    You will need to move all instance variables and behaviors to family level. It's a time consuming task, but you need to do it now, otherwise it will take 10x more time later when your project grows bigger.

    Follow this tutorial:

    https://www.scirra.com/tutorials/535/ho ... o-a-family

    Also, if two objects are very similar (for example different types of trees), it's better to use one sprite with different animations.

    2. Use containers.

    If you add Enemy, EnemyRange, EnemyHealth to the same container, you'll only need to create an Enemy and pin EnemyRange and EnemyHealth.

    You don't need to worry about creating or destroying EnemyRange and EnemyHealth, it will be done automatically.

    You don't need to link them together using EnemyID variable. Every time you pick one object from the container, others will be picked automatically.

    For example:

    Bullet on collision with Enemy

    -> Subtract 1 from Enemy.health

    -> EnemyHealthBar set width to Enemy.health (you don't need to pick EnemyHealthBar by EnemyID)

    With families and containers you should be able to significantly optimize and de-clutter your code.

    3. Use different event sheets. 260 events in one sheet is a bit too much.

    I would definitely move all enemy AI stuff to a separate sheet.

    4. Create a new layout, name it Assets and dump all your objects to that layout. I'm talking about shadows, corpses, steps, range circles, text captions etc.

    C2 requires one instance of each object to be added to a layout, but it shouldn't necessarily be your main Game layout.

    Sorry, I didn't get to the AI part, I think you need to fix all these issues with your project first...

  • Sure, if you share the capx here or PM me, I can take a look.

dop2000's avatar

dop2000

Online Now

Member since 26 May, 2016
Last online 13 Mar, 2025

Twitter
dop2000 has 262 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