mardoch's Recent Forum Activity

  • I get it, now my code looks like this and it's supposed to work correctly:

    But it doesn't. Seems that the problem come from this line

    -> System: Set PlanetSpriteSelected to AdvancedRandom.Weighted

    as it don't copy the data in the variable. I tested it also not as a local variable but as a global variable and the is "0" instead of the sprite's name as it is set on the table.

    I also try to test it when i click on the mouse button but the result is still the same.

    I really don't know where the problem is because I already used a similar code in another sheet and it works very well.

  • Ok thanks, that was the issue.

    So now I'm getting close to what I want to do. I can save in my advancedrandom probability table the datas with the corresponding set.

    Now, is there a way to shuffle this table? so I can take a random entry (the last of the table for exemple) and create the object.

    I don't even know if this solution is a good way to do what I want in the end…

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I see, so even when I try little I can see there is a problem with the advancerandom table. If I ask it to add the entry from the array, it doesn't work

    And still my Array is loaded correctly. Non sense…

    It understand that there is 25 entry but won't display the datas from it

  • Oh, and I changed of course my array to fit with the object's name:

  • Ok I understand my mistake about the object by name. So I changed a bit my function with your suggestion:

    But I still don't have the objects created.

    About my probability table, I don't use it for now but my first idea was to add all the entry for the "B" set for example, and then make a shuffle to randomise the selection. I planned to pick the last item of this table to create my object like,

    -> System: Set PlanetSpriteSelected to AdvancedRandom.Weighted

    In the end I know how to create a sprite from an entire array and delete it from the table once it's created but that mean I have to create an array for each set. I'm looking for a solution where I can have all objects with different set in the same array and then select the objects with a specific set called.

  • Hi everyone,

    I was wondering if there is a way to create an object selected from an array and then delete it from it when it's created to avoid some duplication.

    In other words I have this table loaded on an array:

    That's planets I want to create in my game. the sprites object are created and they all are in a family named "SpaceMap" with 2 variables: Name (corresponding to the 1 column) and the Set (corresponding to the 2nd column)

    To create my planets sprite on the layer, I use a function:

    In the end, when the object is created, I delete it from the array.

    Seems I'm missing something, but don't get what for now.

    Thanks if you can provide some help!!

    Depending of the type of Set (A,B,C,D…) I want to create a specific planet. So I used a parameter to my function (SetType)

    Seems I'm missing something because it doesn't work.

    If anyone can provide some help, it will be great! Thanks!

    Tagged:

  • Thanks R0J0hound, I'll finally use your alternative solution as it don't request a lot of math and the result is the same!

  • Hello everyone!

    I was looking for some solution about my idea, I want to crate an abject in the blue zone but not in the red one:

    So I have read this very interesting post but didn't get something about the code, so maybe someone can give me some explanation. Or maybe I'm all wrong.

    I used this code to spawn my object:

    x = (cos(random(0,1)) * radius) + position

    y = (sin(random(0,1)) * radius) + position

    So I did presume that the (0,1) is supposed to be the start position and the en position. so for my zone, that's probably (118,256)

    My circle is 256 so the radius is 128. Then my code should look like this:

    x = (cos(random(118,256)) * 128) + position

    y = (sin(random(118,256)) * 128) + position

    Unfortunately, it doesn't seem to be correct. Seems that I didn't get how it work so I would appreciate some explanation!

    Thanks

    Tagged:

  • After some research I finally identify where the problem come from.

    When I try to replace my 3d object's face with a family object, it break it.

    In the end, if I have more than one object in my family it won't work and it will only accept one object.

    So if anyone knows how I can fix this, I will be really thankful!

  • Hi GeoffB! Yes, I know this subject is still about 3D objects and their sprites, maybe I should continue this on the previous topic.

    But my problem is slightly different this time, as I can't use containers. As we know, families can't be used for containers so using parent UID fits more with this, as I want my picked sprite to be different with some conditions.

    So yes, containers are greats but it can't work in this case.

    So I create the correct sprite according to a specific instance, like:

    -> System: Create object NME_Top.ObjectTypeName&"_Sprites" on layer "HiddenSprites" at (700, -100), create hierarchy: False, template: ""

    but the 3D object doesn't pick the correct sprite. Even if I use an instance UID comparison.

    My main problem this time is to use a sprite from a family, so I don't need to create a specific 3D object for each enemy I want to spawn.

  • Hello everyone,

    I have an issue actually with my game and can't figure it out. Maybe my method is not the easiest one for what I want to do but here are the facts:

    I have a family object created for each of my enemies name "NME_Top". It's a simple 2d sprite where I can put all my behaviors and instances so I can edit each one easely.

    Then for each of my "NME_Top" objects there is a 3d object created over it named "NMETop_3D". It's the same for every "NME_Top", it purpose is only to display the ennemy sprite on the right face. The sprites are in a family named "NME_Top_Sprite"

    So first I call a function to create both my 3D object but also the right sprite from the family.

    The function itself is quite simple, I set the variables for the 3D object and the sprite object so they can match with the right "NME_Top" object.

    Then when the function is called and the 3D object and sprite created, I make the 3D sprite follow the "NME_Top" object and set its right face on the sprite object. Then for every movement, the good animation is played.

    Unfortunately, I can't understand why for each 3D object, "NMETop_3D", the same sprite is called. It's a problem because each 3D object is supposed to call the sprite object with the same ID instance I have assigned for both of them.

    I guess the main problem is because of the family objects but I'm sure there is a way to make this work.

    I'll be glad if anyone knows how I can fix my problem!

  • Sometimes the order in conditions matters, try moving Slot_ID= to the top of the condition above 'powerup is overlapping slot' to see if it makes a difference.

    That's was that! Thanks again for your help lionz!!

mardoch's avatar

mardoch

Member since 21 Nov, 2013

None one is following mardoch yet!

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies