smumpy's Forum Posts

  • i haven't look into your code but did you also create logic to simulate the movement? or are you, the player, controlling the enemies with the keyboard or some other kind of input (keyboard/touch)? there needs to be something that actually tells it to move in a set direction.

    you could do; every x seconds [for x enemy] simulate movement up/down/left/right

    or also; on left arrow key hit [for x enemy] move left

    etc...

  • that seems counter productive, (shutting down this post i mean) i feel like this topic could help others trying to implement something similar once it is fixed, if nothing else everything discussed has led to two pretty solid solutions;

    either use drag and drop method if timescale is set to 1 (and thus you can have an "every x seconds" change to _____ position; based on consequent conditions)

    or

    use your suggestion of animation frame changes with touch controls to accomplish the same thing

    either way thank you for your help through this, and Moderators if you do intend to shut this down please give me some time because i am using this thread as a base to modify my project

    quick edit:

    Got a little further by using the slot1text = power.uptext (inverted) as the condition that returns to original position rather than using notslotted.

    the problem really lies with the conditions that start triggered to the same conditions that return to original position (Notslotted = true, Slot1active = False, Slot2Active = False, Slot3Active = False) this keeps not only making it so they return to position when you try to slot/equip them, but also (for some reason) they don't appear to be cooperating with the SlotCounter position reset. however, i believe the text condition got me further because it only triggers to true ONCE you equip it, allowing it to activate only after another has been equipped (again, that was accomplished by using the add 1 to SlotCounter, if SlotCounter is over 1 check all powerups, for every power up not equipped (now using text logic) return to original position)

  • Still having issues, it kind of works, however, when you place it it enters an infinite loop of glitching between the two spots, most likely because it checks if over one, changes positions based on notslotted variable, then resets the counter so it kind of goes from one to the other over and over because it is constantly switching between slotted and notslotted, need to find a way to break it up

  • I think I figured it out

    Every time a power becomes equipped to slot(x) add 1 to slot(x) counter [number variable]

    Every time slot(x) counter is above 1 check every power up; for every power up that is not equipped [notslotted = true] then reset position and reset counter to 0

    I think this will create a constant check that resets position without relying on the timescale

    I will update once I have implemented and let know if it worked or not

  • also i think you are right about changing it to animation frames rather than objects themselves, that might be easier to work with, hopefully i can find an alternative fix though because that would require quite a bit of reworking

  • so for anyone interested i've progressed a little further by adding set notslotted to false when powerup is touching any one of the 3 slots, and then set it to true in the same line of code that sets all the other slot(x)active instance variables to false ((once a given powerup is equipped to said slot))

    now when you set any power to equipped it will save it as equipped and returns the other power ups to original positions when you exit the menu ((if you reopen the menu then the other power ups are at original positions and equipped are in the equipped slots))

    however, it appears that the return to original position works at first but then stops, i've noticed that it works correctly approximately 2 or 3 times before they begin stacking upon each other again

    i believe the reason for this is that the "return to original position" code has a trigger once condition so it does not interfere with the drag and drop functionality ((without the trigger once you cannot move them at all as the conditions are set upon layout start and it keeps them at their positions))

    my immediate solution would be "every x seconds, if notslotted, then return to original position" however, the timescale is set to 0 when this menu is open as the game is paused, meaning ((i believe)) that the every x seconds function won't work

    if anyone has an idea on what to use instead of "every x seconds" that doesn't rely on the timescale being set to 1, please share your thoughts

  • really my thought here is to make it either when overlapping a slot or in position then set notslotted to false and then there just needs to be some event that resets not slotted and in doing so that would return it to its original position

  • yeah that's how it works there are ability icons you drag and drop onto the different slots from a visible menu, the making them swap bit is literally all i am trying to solve here

    if there was only 1 slot then the slot1active, etc... instance variables would be redundant because you would only need the 1 slot to change out and it would be as simple as "is equipped" then do everything else

    however, because there are 3 slots if you set it so ;

    is ability 1 equipped, then reset positions on all other power ups

    then you couldn't assign more than 1 ability to more than 1 slot at a time, for every time you did it would reset all the others

    again you're right, this would work if it was only the 1 slot

    the actual problem is when assign ability 1 to slot 1 and then assign ability 2 to slot 1 they both stack up instead of returning ability 1 to its original position

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the slot and text objects are required for later when you're actually playing the game to determine which powerup is assigned to which button in-game, i just used the text to assign position for convenience but essentially the text represents "is equipped"

    the instance variables were to determine which power up is on which slot

    which obviously you understand

    however as i think it through the proposed solution would lead to this problem;

    slot 1 = 1 of 16 possible instance variables representing the 16 different abilities

    slot 2 = 1 of 16 possible instance variables representing the 16 different abilities

    and slot 3 = 1 of 16 possible instance variables representing the 16 diff abilities

    also makes sense to have a neutral state "notslotted" which states there are no powerups active on a given slot

    now you make it so if slot1 = ___ instance variable set that ability icon to position of slot1 and all others to original position

    and so on through the other slots

    however, if you did that then you wouldn't be able to equip more than 1 power up at a time because it would constantly be resetting the other positions every time you equipped 1 power up to ANY slot

    or is there something i missing with that?

    that is why the code became so complicated, it is just to determine if any one power up is currently slotted and prevent that power up icon from being moved if another is slotted, i mean honestly it seems the text objects and instance variable option is interchangeable however they both lead to this problem

    oh the reason i used text objects is i was going off what you suggested originally in my other post

    construct.net/en/forum/construct-3/how-do-i-8/how-do-i-make-equipabble-power-140846

    about making the slot instance variables = the powerup instance variables but thought the only way to do this was using text objects in place of the instance variables because as i understand you cannot make an instance variable = another instance variable, maybe you meant to make it a string instance variable but even then i ran into problems, regardless the aforementioned problem is what matters because everything is working other than the returning to original position once a new power up is slotted

  • Use this if you are intending to use drag and drop functionality on a visual menu to drag and drop abilities [icons] into equipped slots (abilities/items/etc...) and use said menu to determine what abilities/items/etc... are currently equipped to your character

    So basically the idea is there are 16 abilities and 3 slots that you can equip them in, each ability is represented by an icon in the menu, you drag and drop the icons onto the slots to equip them. i have figured out how to get most of it working but i am stuck in the regard of getting the ability icons to return to their original positions once a new one is placed onto the slot.

    each ability has 4 instance variables atm (slot1active, slot2active, slot3active and notslotted)

    each ability has a text object associated to it and each slot has a text object associated with it

    the logic looks like this:

    if dropped and overlapping slot1/2/3 then set slot1, slot2, or slot3's text object to the said ability text object

    if slot(x) text object = ability(x) text object then set said ability (x)'s icon to slot position and set slot(x)active instance variable to true on that ability

    if slot(x)active instance variable is true on given ability then set slot(x)active instance ability to false for all other abilities (this goes through slot1/slot2 and slot3)

    if slot(1,2 and 3)active instance variables are false and notslotted is true then set ability icon to original position

    simultaneously if any ability is dropped anywhere but slot1,2 or 3 then return to original position

    i keep running into the problem that if slot(1,2,3)active instance variables are false then return to position, basically disables the ability to drag and drop them at all, however, if that logic isn't in there they don't return to their original positions. i added the notslotted instance variable in an attempt to disrupt this so it is not active one startup but then becomes active once it is slotted/unslotted, but i am not sure where/how to work in notslotted, or if that is truly the solution.

    does anyone have an idea as to how to approach this issue?

    my thinking is that there needs to be something that ensures that only 1 ability is slotted at a time on each slot, then something else that triggers the previous ability to return to original position once a new ability is equipped to a given slot. i just am not sure how the logic of this would look.

  • do you mean enemies that you approach, pick up and then throw as your playable character?

  • oooh my bad, that makes sense, thanks

  • hey so i tried to implement this and am having trouble figuring out how to set slot's instance variable to power up instance variable, I set them both to numbers,string and boolean but the number is the only one that seems to have the set slotvariable = ____ function, however i am not seeing powerup instance variable in the drop down list and it doesn't seem to recognize it if i type it in. does it not recognize other instance variables? and if so how does one make it set slotvariable to = power up variable?

  • oh cool ok this eradicates the need to set the others to false then, thanks yet again

  • ok so have slot1, slot2, and slot3, then make it so when power-up1 is dropped into slot1 set slot1 animation to correlate to power-up1, right?

    then just have instance variables on each slot totaling 16, correlating to the 16 power-ups, so whichever power-up is dropped into slot1 it sets that power-up instance variable to true and others to false on that slot?

    that makes sense to me i just wanna make sure i'm getting what you're saying