dop2000's Recent Forum Activity

  • It's difficult to understand what's going on in your screenshot. In the second event you need to pick the tower instance which is being dragged. Also don't use "Trigger once" like that!

    Here is a simple version which works with mouse and touch:

    dropbox.com/scl/fi/kh30pucvsn4bnx02qzcyt/dragTowers.c3p

  • If you only need to know which instances were destroyed, then you obviously don't need to save their full state as JSON. If you place these objects manually on the layout, they will have fixed UIDs, so you can simply store the list of UIDs which were destroyed. Use an array:

    Player on collision with sprite: Array Push back Sprite.UID, destroy Sprite

    .

    However, if you need to know which instances were destroyed and also save all properties of the remaining instances, you can't use IIDs.

    From the manual:

    Since you are destroying instances, you need to use UID or a different (custom) identifier. Say, add an instance variable "Code" to the sprite, set a unique code for each instance.

    When leaving the layout:

    For each Box : Dictionary add key "Box."&Box.Code with value Box.AsJSON
    

    When returning to the layout:

    For each Box 
     Dictionary "Box."&Box.Code exists : Box set from JSON Dictionary.Get("Box."& Box.code)) 
     Else : Box destroy
    
  • So, for example, the array has two rows - first contains enemy types (zombie, goblin, skeleton), and the second row contains the amount of points. Is this correct?

    Then you need to loop through the array searching for enemy type. Or use array.indexof() expression:

    Add Array.at(Array.indexof("zombie"),1) to Score

    This may be easier to do with a dictionary instead of the array. Then you simply use Dictionary.Get(enemytype) to get the number of points.

    You can store the enemy type in an instance variable on the sprites.

  • To be honest, I don't understand your question. What game are you making? What are you trying to achieve? What do you mean by "visual array"?

  • I think 'restart layout' should reset the groups.

    By the way, this is so wrong that restarting a layout resets all groups in the entire project, including groups from all other layouts. There should be at least an option to disable this.

  • Probably CORS issue. Press F12 in preview and check for error messages in the console.

  • You can't. Even if you create some sophisticated protection, people will still hack it. So just don't worry about it.

  • Try searching the forum for "arc" or "trajectory".

    Here is an old demo from R0j0hound:

    dropbox.com/scl/fi/6jrmw7mmgprdtp11axoed/TrajectroryCalculation_R0j0.capx

    Another demo by Von Perkele:

    howtoconstructdemos.com/trajectory-calculation-two-methods

  • That JSON string needs to be loaded into JSON object, not Dictionary object.

    Add JSON object to the project, use JSON Parse action.

    See this example:

    editor.construct.net

  • Maybe I don't understand the issue, but can't you have the event listener for the family?

    runtime.objects.Enemies.addEventListener("instancecreate", (event) => {

    console.log("A new instance was created:", event.instance.objectType.name);

    });

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Families are referenced the same way as objects. For example:

    runtime.objects.Sprite.getFirstInstance();

    runtime.objects.FamilySprites.getFirstInstance();

    I'd like to know how to get the family name of an object I have a reference to

    It's usually the other way around - to get the object name of a family member use FamilyInstance.objectType.name

    I don't think it's possible to find which family this object belongs to. But you can try to pick family instance by object UID. Here is how I would do this with events:

    On Clicked Sprite
    EnemiesFamily pick by UID = Sprite.UID
    

    If the sprite is a member of EnemiesFamily, this event will pick it.

dop2000's avatar

dop2000

Member since 26 May, 2016

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