Tumba's Forum Posts

  • Oh, ok, will definitely try it out.

    Thanks for clarifying it.

  • Thanks for the answer.

    Sadly, I didnt understand how to use the PinnedUID...

    Tried to, but couldn't figure out how to get the PinnedUID expression to show.

    However, no panic.

    I just assign the HeroUID to every Pinned object.

    That way, when the hero is destroyed I can do "For each [Family] with HeroId = Heroes.UID" to mass-destroy the needed objects.

  • 1. A way to refer to a pinned object.

    Say I have a sprite with a pinned text.

    If the sprite is selected it would be nice to "select pinned" [text]...

    I know there are containers, but in my case I might end up destroying the linked object and that would destroy also the container....

    Pretty please, add "Select pinned [object]" to C2, if it isn't too much of a hassle...

    2. Comments between actions

    Now I only seem able to add comments to events.

    I have several events with lots of actions doing different things.

    I'd love to have some kind of way to group the actions into subgroups just for making them neat and easy to manage.

    A comment row that I could attach between actions would be the easist way to achieve this, I belive.... (groupin actions would be also great...)

  • Thank you for your help.

    I'm still a bit shy of using every tick, as I will be wanting to show different thing at different times in the txtCharDeBug.

    I solved it the other way around. When creating the hero and txt fields belonging, I assign a id variable to the hero for each object attached to it.

    Thus, in this case, the hero will have the uid of the txtCharDeBug in its txtCharDeBugId variable.

    This allows me to "pick by id" the fields I want when the hero is triggered, instead of monitoring each field each tick.

    Oh, how I'd low to "pick [txtCharDeBug] pinned to Heroes" when f.ex. looping the Heroes... Would save tons of work, but alas....

    Anyway, could not have solved it without your help.

    Thank you very much!

    Consider this case solved.

  • Ok, that probably works.

    I tried originally to incorporate the action into the on mouse left button released, as it neatly knows which hero to assign the text Objects to. But it updated just once and then all heroes.

    Could the effect be achieved some other way, maybe related to the mouse left button released?

    Every tick, souds a bit overkill, as the purpose is just to see which heroes are selected in the start of the game.

    After that the selection area will disappear and not be used any more...

    Also I'm a bit worried of "pick nearest" as heroes can, theoretically at least, overlap each other...

    <-edit-> I do assign the hero UID to every object related to the hero, so I'll probably manage to cook up something<-edit->

    If you have another idea I'll be happy to hear it, if not, I'm happy already. Thanks!

  • Noob question...

    I have a feeling that the answer to this one is simple, I'm just not able to grasp it at the moment...

    I have a simple layout with sprites of family "Heroes" created on a tiled background covering the center of the window leaving the sides bare.

    What I want:

    When a hero - sprite is dragged and dropped outside of the tiled background the dragged sprites boolean "Selected" should turn to true.

    When a hero - sprite is dragged and dropped inside of the tiled background the dragged sprites boolean "Selected" should turn to false.

    What I have:

    When a hero - sprite is dragged and dropped outside of the tiled background, all Heroes boolean "Selected" turns to true.

    When a hero - sprite is dragged and dropped inside of the tiled background, all Heroes boolean "Selected" turns to false.

    I cannot refer to a specific sprite object as all the sprites are generated randomly from the Sprites in "Heroes" family.

    I assume that this might even be solved by placing the action inside the correct event. I tried with several possibilities, but alas, fail every time...

    Please, what is wrong?

    Link to my CAPX:

    dropbox.com/s/fnecrxap6gxqpqa/CutthroatCaverns.capx

    The fun happens on the Village layout. Ignore the rest...

    This CAPX has a pretty nice Debug system that shows the UID of the sprites and the "Selected" boolean value when it changes.

    So experimenting should be easy...

  • 1. The present Set CSS style action lets me set different CSS values in the System -> On Start of layout one by one.

    Is it somehow possible to use a CSS file and just set the class of, ex text objects to something?

    2 The present Set CSS style action lets me set different CSS values in the System -> On Start of layout. I seem not to be able to use it in, ex Mouse over -events.

    I want to create a CSS file and set objects to different CSS classes like I would normally do in HTML/Javascript. Is it possible?

    Ex, I have a Family: txtMenuTexts

    I want to set them to css Class='Normal' on layout start.

    I want to set them to css Class='Hover' when Mouse Cursor is over them.

    I want to set them to css Class='Normal' when Mouse Cursor is not over them.

    This is basic functionality when doing HTML/Jscript.

    But the only way I can achieve a near (not very) decent management of different styles now, is by using a staggering amount of global variables for the different font faces, sizes and colors + multitude of events, setting those values one by one. Quite unpractical...

    Is there any other way of controlling text styles apart from what passes as CSS in Constructor or global variables?

    Or am I just doing it all very wrongly?

  • Since the subject of this thread has completely changed from the original, I'm ending this thread here and taking my CSS related question to a new topic.

    Thank you everybody for helping me.

    You are the Best!

  • Didn't look at your Capx yet, and beeing a noob to Construct 2 myself I'm not sure if this helps. Hoping so.

    I created a family (Heroes) of several sprites.

    Then I created heroes with something very similar to this:

    system -> Create object Heroes on layer 1 (10,10)   

    =First hero needs a postition

    system -> Create object Heroes on layer 1 (Heroes.X+60,Heroes.Y)

    system -> Create object Heroes on layer 1 (Heroes.X+60,Heroes.Y)

    = The rest of the heroes are created randomly from the Heroes family with a dynamic position referred from the latest instance of Heroes. I only created three, but the principle should work with, for example, a For loop.

    Just set the first instance of family somewhere and loop the rest.

  • Ah sorry.

    Additional condition.

    Found it.

    Thanks.

    Tried to do it as an action...

    Still having problems with finding the Set CSS... cant find it in actions as the Manual claims... Is it too somewhere else?

    <-Edit->

    Found Set CSS...

    But only in System -> Start of layout.

    Didnt find it in for example txtText -> On Created

    or

    Mouse -> Cursor is over txtText

    Which makes it close to useless in my opitnion...

    I would initially want to set a style of Text objects to a CSS style, change them to another when the cursor is over them and back to original when cursor is off.

    There seems to be no way of doing that other by not using css...

    Am I right (hope not...)?

    <-Edit->

  • There are no Pick options in Zorder at all?

    Just "Move to top", "Move to bottom", and "Move to layer".

    Something wrong with my Construct?

    Im also going nuts when trying to find "Set CSS style" for textboxes - I cannot find that action at all

  • I must apologize for my earlier message, that on a second reading might have sounded a bit arrongant. I hope I didnt offend...

    I tested, again, writing the creation code after each Hero creation.

    I must have had some other problem earlier, as I remeber the effect to be totally different. Now, the result was identical, that is, the nametag is positioned wrongly...

    BUT, re-reading closely your answer part 2 , the one I arrogantly tossed aside earlier, I noticed that you suggested creating the text using the heroes imagepoint xy instead of the heroes xy.

    AND THAT DID THE TRICK! \o/

    My understanding of why and how, and how it differs from what I did earlier is far beyond me. But I'm happy, and that is what counts.

    To share my happiness, I'll just share my capx with everybody.

    It doesn't contain any rocket sience, but there is a nice example of drag and drop done with events and the dynamic hero creation(very simple)

    dropbox.com/s/fnecrxap6gxqpqa/CutthroatCaverns.capx

    (Thanks to Whiteclaws)

    (Hope this works. First time Dropbox user. Would make it a h-link but too low rep..)

    If I may, one more quick question...

    When I pile all the heroes on top of each other and drag and drop, it drags and drops all of them. A nice effect, but one I do not want...

    I heard that there is a "just once" event modifier or similar , but can't find it. And if I found it, would it help?

    Alternative solution: prevent heroes from piling...

    What is the easiest way to do it? Creating a colision event or is there a ready made behaviour that would make me even more happy?

  • The first suggestion was the one I started with in the first place. It didnt work, as all seemed to pin to first hero. I can try it again, but Im quite sure I didnt work the first time.

    The extra position is unnecessary, I know, but it was there to show that I try to enforce the position in several ways without success.

    Ill try suggestion 1 again, and then Ill just try to maybe move the text to hero and then pin...

    Ill let you know how it went....

    Btw, if I wanted to share the capx on the forum, how would I do that?

  • No frames, just a plain image.

    Still experimenting with basics...

    I'd be thrilled to share the capx on the forum, if I knew how to share it here? Link to some ftp server?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, I have the following problem.

    I've go an unspecific amount of hero objects in a "Heroes" Family.

    I randomly create an unspecific amount of heroes, neatly standing in a line.

    All good so far.

    Every time a Hero is created, a nametag is created for that hero.

    That name tag is then pinned and positioned to the hero just created.

    The pinning works nicely. When I move a hero by mouse down, the name folows nicely.

    BUT! When the nametag is created it doesn't position itself correctly at heroes imagepoint 1.

    When created, the first nametag appears about x + 100, y + 100 from the hero, the second about x + 200, y + 200 , the third about x + 300, y + 300 , and so on. The numbers are just an aprox-guess and are there to give you an idea of my problem. (but might have something to do with the way I create the heroes, see below...)

    I assume I do something wrong but cannot understand what...

    Example with 3 heroes:

    +System -> On start of layout

    System -> Create object Heroes on layer 0 at (LayoutCenter.X -100, LayoutCenter.Y -100)

    System -> Create object Heroes on layer 0 at (Heroes.X + 60,Heroes.Y)

    System -> Create object Heroes on layer 0 at (Heroes.X + 60,Heroes.Y)

    +Heroes -> On created

    System -> Create object txtName on layer 1 (Heroes.X, Heroes.Y)

    txtName -> Pin Pin to Heroes(Position & angle)

    txtName -> Set position to Heroes(image point 1)

    Works fine, but the position is wrong for some reason...