mardoch's Forum Posts

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

  • Try Construct 3

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

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

  • Ok thanks lionz, with the 'copy picked' selected it's a bit better: Now I can see that the cooldown effect is applied on the correct power-up object.

    But it still use the action of the power-up on the first slot for both. That's really strange because now it should works.

    Even if I inverse the event, like "if Power-up is overlapping PU_act_Slots", the result doesn't change anything…

  • You should use a variable for this. Use a boolean "Infected" that turn to true when your object is in collision with an infected object.

    Then if you don't want to use an animation, maybe you can create another object over the infected one and use the pin behavior. The new object created can use it's own animation to look like the virus spreading over the first object.

  • Thanks but even if I change this my result is the same

    Whenever I use the "Y" or the "B" button it always call the power-up overlapping the first slot.

    I also use a cooldown as you can see. When the power-up is called it put the cooldown boolean to true and make the power-up sprite opacity to 50%, so I can see if the function work. It should work for only a power-up at once but actually both power-up's opacity turn to 50%. That's mean it doesn't make a difference between the power-up on Slot_1 and the power-up on Slot_2.

  • Hello everyone!

    I'm in trouble with a function problem. I have for my game two slots for my power-ups. Each one can be activated with a button, "Y" for slot_1 and "B" for slot_2.

    Of course it only works when there is a power up overlapping the slot.

    First I did this:

    It works fine and I can call the corresponding power-up for each slot. But I have to duplicate each power-up (event and action) for each slot. And I'm a bit lazy, so I thought that I could reduce my code to just one function that will call the correct power-up for each slot. So I will only need to edit this for futures power-ups.

    So I did this:

    So it choose the correct power-up in the function but unfortunately, it only choose the power-up overlapping the slot_1. It doesn't consider the slot ID number. I tried many different possibilities but it still doesn't work.

    So if anyone has a solution about this, it will really be helpful!!

    Thanks!

  • Ah! Thank you dop2000!! I knew I was messing up with something on the axis, I still need to practice!

  • Hi everyone,

    I'm just discovered the Advanced Random plugin and think I can use it for my game when I need to drop pick up some loot randomly.

    For now I create an array as a .Json file to manage my loot:

    The column 0 is for the name, the 1 is for the rarity of my object and the 3 is for the object cost. For now I don't need to use the "Cost" column for what I want to do.

    My main idea is to use the rarity column for the weight entry in te AdvancedRandom. So for exemple I would like the object "Banana" to spawn 75 more time than the others objects.

    I tried to create my AdvancedRandom table using this code:

    I can see that is doesn't really the correct way to use the plugin, the debug show me kind of a mess and repeat 3 times my datas (because of my 3 column)

    I can I correctly set this?