vee41's Recent Forum Activity

  • This plugin might be some help in that scenario: scirra.com/forum/plugin-nickname-behavior-nickname_topic57943.html

    But as for your problem, why not make two instances of 'ArmyList' object? Unless there is something radically different between those two, it seems like the best option to me in your case.

    Then you could call them like:

    Select all armyList

    armyList(0).variable = 2

    armyList(1).variable = 4

    Do note that you'll need to have all armyLists picked whenever using this method. You could also save their UID's and use them to directly pick individual lists.

  • But for complex actions I could use Functions. Like a function called "turn it into a nemesis" could double the object's size, restore it's HP, give it a powerful weapon and attach it to him, start showing it on the minimap, and point the player in its direction.

    Absolutely, that kind of stuff is where functions become useful. As for calling function with picked UID's you could do something like this:

    text variable UIDs

    pick sprites you need

    for each picked sprite

         append sprite.uid & ";" to UIDs

    call "Function" (with UIDs as function parameter)

    "OnFunction"

    for 0 to tokencount(function.param(0), ";")-1

    pick sprite with UID tokenat(function.param(0), loopIndex ";")

        do your thing

    What this basically should do, is save all selected UID's into text variable separated by ; symbol. Then inside the function you can parse the string again to pick them one by one.

    I still think C2 offers much simpler ways to do stuff like this, it feels very 'coderish' way to do stuff! :) C2 allows for higher level of design and I really have to force myself out of the coder mold when using C2 to maximize it's potential.

    You'll still have a problem if you can't use families, so you'll need to have all the sprites in single object. Hope this helps :)

  • squale

    Did you import your xml file to your project? Right click on the project explorers "Files" folder and choose import files.

  • justifun

    That's just about the exact of what I need, but I guess there's no way to accomplish it in a simple manner if I don't use Families, right? I was trying to avoid them because I teach Construct at a local University, and not all my students have access to Construct 2 Full.

    Is there a way to reference "any Sprite"?

    That way, I could create a local variable for the objects I want to be double-sized when clicked, say a variable called canDoubleSize. And I could check for that variable on my mouse-click then call the double-size function.

    on mouse clicked on "any sprite whatsoever"

    \--> AnySprite.canDoubleSize = 1

    then do what your example does, but sending the UID to a global variable. Then the function searches for "any Sprite" with that UID and runs on it.

    I hope I explained it clearly..

    Check the example I posted earlier, you could have all your sprites 'inside' same object to simulate families.

    To me it seems you don't really need UID's, functions or anything like that. It could be as simple as having that canDoubleSize variable, then on certain conditions you execute something like this:

    For each sprite

    sprite.canDoubleSize = 1

          Do the doublesize

    This is shown in the demo I posted as well.

  • Here is a demo the hopefully clears it up a bit.

    Slot demo

    Is this anything like what you are looking for? :)

    It should not matter how you create your items, if they exist when you are clicking them everything should be ok.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Would be a bit easier if you posted .capx file of your game so we could test things and show the solution you :)

    But, it seems like you are not picking an item that you are placing into a slot. I believe that is what you tried to do with 'ident' variable, that is not necessary at all. You can use 'UID' instead, which is Unique IDentifier for every object in game. Save that into 'lastClickedItem' and when clicking on slot, add condition 'select item by UID lastClickedItem'.

    Be sure to check 'Picking'-section in the FAQ for better understanding on how it works! :)

  • You could use families; put all weapons in 'Weapons' family and use event 'Create Object' on the family. I recall this creates random member of the family.

    Other option would be to put all weapons in separate frames/animations of single sprite and on creation randomize the animation.

  • Add var_Time_old variable.

    Add event:

    var_Time_old doesn't equal var_Time

    add 30 to var_distancer

    var_Time_Old = var_Time

  • I recommend you take a look into instance variables. They are variables specific to one instance of object (single character for example). In my opinion they are the best way to go here :-)

  • gamekill

    You could do that with families easily. Or you could use little sprite trick where you store different objects in different animations. Here is a little demo I made to demonstrate.

  • thanks alot vee41 i will work on it and will tell you the results :)

    edit #1 : yeah that kinda worked like i described but there is a small issue that it doesnt hover upwards than falls if i could draw a waypoint for that. I would be happy.

    I tried to give physics effect to the diamond but it didnt give the result that i wish i had :D diamond was floating around because of both bullet and physics behaviour imho :)

    Hope this is some help to you

    Did some minor alterations to make it appear smoother :)

  • Rhindon

    Here are couple of different ways to make healthbars.

    Hope it's some help to you, includes picking stuff like you did too :)

vee41's avatar

vee41

Member since 12 Apr, 2012

None one is following vee41 yet!

Trophy Case

  • 12-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

14/44
How to earn trophies