DiabloOvermind's Forum Posts

  • Thank you for replying, I eventually figured a slightly longer way to do it, but it works well enough.

    Instead of having one event including the button family (e.g. On any "Button_Family" pressed, do XYZ), I created 18 events, 1 for each button, essentially getting rid of one dimension.

    On Button pressed

    For each "Sprite_Family" -> Set opacity to (Global variable counting total jobs for that time frame / the correct variable on the sprite, which I can now name in the event itself instead of trying to have the logic pick it for me

    Absolutely not efficient, probably going to make people retch, but its for a personal project, not sharing it, not selling it, so thats good enough for me!

    Thanks for you reply again dop2000, surely this will help someone else one day

  • I am making a small project to help me manage some stuff at work (self employed), and I am trying to do something that sounds like this:

    I have a set of 18 buttons, all setup to represent specific timeframes (e.g. January 2024, Year 2024, All time, etc...). These buttons are in a family.

    I have a map of my region with 54 different postcodes. These 54 postcodes are all separate sprites which I have put in a family.

    What I am trying to achieve is some kind of "heat map", where whenever I press a button, every postcode on the map "radiates" proportionally to the number of jobs I got during the timeframe selected by pressing the button.

    So I have setup each button with its own variable (set up by the family itself, not on each button separately), and have created a global variable to store which button has been pressed.

    For example, if I press the button "Year 2024", the global variable will change to "Year_2024". The reason I set it up this way is to I could then "pick" the variable on my postcode sprites based on what the global variable value is, as these sprites have 1 variable by time frame (so 18 variables), each with their own values, variating for each sprite, for each timeframe.

    I have set up my variable names on the sprite family to be the same names as whatever the global variable "text value" will be when you press any button.

    So the logic Im trying to write is this:

    When any button of the "button family" is clicked on -> Set global variable value to the name of that button's variable (ex: you press the button Year 2024, now the global variable text value is "Year_2024". You press Year 2023, global variable text value now becomes "Year_2023", etc...)

    Then

    For each Sprite in the Sprite Family, "Pick" the value from the variable with the same name as the global variable (e.g. you clicked the button "year 2024", global variable now shows "Year_2024", so you need to pick the variable named "Year_2024" for each sprite in the sprite family)

    Then

    Read the value associated with the correct variable (here, Year_2024, the value will vary depending on postcode) and store that value in another variable on the same sprite, for each of the 54 sprites independently.

    Than finally

    With the correct value taken from the correct variable for each sprite now stored in each sprite independently, change the opacity of each sprite based on their respective values. Higher value, higher visibility.

    I hope this makes some kind of sense to anybody.

    I would really appreciate some help on how to achieve this, and unfortunately, if this really, REALLY have to involve arrays, I'm going to have a massive problem because I don't understand arrays, or how to pick values out of cells etc... so a solution not involving arrays would be preferable.

    Thanks in advance to anyone willing to help.

    I'll keep trying on my end but I don't have much hope.

  • Hi Braus !

    How about this :

    (system)Every second :

    (system)Pick random "MyInstance" object => Set invisible.

    How would that work for you ?

  • My bad then

    Thank you !

  • hi yolkgames ,

    Your images are quite difficult to read, since your event sheet is full of variables names and other stuff we can't figure out until we know what they are.

    Here is my take on it :

    I think I understand your "box" object has 2 frames : One frame when it's closed, and 1 frame when it's opened.

    Dragging the key will make it disappear and open the box, making the frame number change.

    On your event sheet, event number 30, you tell your game to set your box frame to 1, then make its animation play, and then make it stop immediately after. That looks weird to me. If you want it to play, let it play, but if you do not want it to play, then make it stop straight away ?

    Also, if you are having trouble with having animation frames, you could isolate each frame in a separate animation, and simply change the animations (containing a single frame only) when you need them. This would suppress the problem you could have with animation stopping/playing, which could be your problem since you are saying your box is "opened and then closed".

    Hope this helps.

  • Hi Unconnected ,

    further responding to duditon 's answer, you could also try and set your containers elements origin points to position your containers elements on spawn.

    For example, if you have object A and B in a container, and you want object B to be 100 pixels south of object A, then simply put object B's origin point 100 pixels above its center, and the object will spawn 100 pixels south of where it "should" have spawned.

    This can help you a lot positioning everything in one go, without having to have any events positioning stuff for you, and also retains every object's position, even on object destruction. The problem is that it's tedious to set up properly if you have lots of objects in your container.

    ________________

    Another solution could be the one I use in my game in progress, which have about half a dozen menus stacked on top of each other : Put every menu in it's own layer (1 layer per menu), set them up how you want them to be set up, and make them appear/disappear by making the layer appear/disappear.

    The only problem with this is that every clickable object will still be clickable , even when invisible. You will only need to make these objects unclickable by using a boolean , off when the layer is invisible, and on when the layer is visible. Pretty simple stuff.

    Hope this helped !

  • Hi sebrosen ,

    I'm not very familiar to particle objects, but this really looks like a particle object with some properties edited to it to make it bouncy.

    I've tried to make the same, and I was able to recreate everything done in your video, apart from the bounce, only using the particle properties, and 0 events, apart from the event that creates the particle effect on mouse click.

    Maybe the bounce is just an advanced part of it, but this should help you a lot already !

  • Small bump, I updated my last post with an image, should be useful I hope.

  • I don't get where the "function" usefulness comes from ? Instead of using a function trigger to start your event, just use the "on object created" trigger, what do you think ?

    In order to have a function triggered event to run, you need to have something trigger this function in the first place. I'm almost certain you know that and probably have another event somewhere that calls your "SpawnDot" function, but it seems over complicated to me, as seen.

    Also, in order for your object to move, you need to have another event that goes like this :

    Dot => on path found => move along path

    at the moment, your object calculates the path to point A to point B, but is not told to move along it properly.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi kellehk ,

    This is probably over simplified, but what about the pathfinding behavior ?

    On Dot spawned, make it pathfind to wherever you need to (even if thats a random cell, as you do have "cell" objects)

    On path found, move along path

    and that's it ?

  • Hi OP,

    As dop2000 said, every single clickable in your game is actually enabled at all times. I am doing a game with multiples menus stacked on top of each other on something like half a dozen layers, and when I discovered I was clicking on half of them at the same time on one click, I wasn't really happy.

    I used groups activation/deactivation to manage this problem efficiently with a minimum of events. All you have to do is program your buttons on your layer, put all these events in a group, and ass a single event saying "is layer X visible" => activate "group", and of course, its opposite, "is layer X invisible" => deactivate "group".

    Really easy !

    Enjoy your game !

  • Hi Semoreh,

    I was just passing by, reading your post and I thought of a potential solution :

    How about adding a global variable that stores inputs and triggers what your button should be triggering by using an event ?

    For example :

    on "A" (any button) pressed => store "whatever "A" should do" in your general variable

    compare general variable value : if "value" = "A" => trigger action X

    Or maybe even better, you could associate every button on your pad with a boolean variable that triggers when the button is pressed, and associate your events with the booleans and not with the actual buttons ?

    Not sure that would work in practice, but what do you think about that ?

    Edit : You could even use events like "on variable A and variable B boolean = true" to trigger events while 2 or more specific buttons are pressed (simultaneously, how you want it to be)

  • Yeah I understand that part, and I understand cell border helps, but when dealing with medium sized sprites, the problem with pathfinding is that the outer part of the sprite still heavily overlaps with cells marked as "obstacle".

    furthermore , let's say you are trying to pathfind an object from the center of your screen to the upper let part of it, with a set path being only horizontal and vertical lines, the sprite will automatically hug the left part of your path instead of staying in the middle... Which, you guessed it, makes the sprite overlap even more.

    Is there not a way to make the sprite stay in the middle of the path while pathing ?

  • Hello fellow programmers,

    I am having a problem I cannot resolve at the moment.

    I am (still) doing a tower defense game, and while I managed to make my pathfinding behavior work more or less properly with small sprites, I have one of my towers that "shoots" a poison cloud that basically "pathfinds" from its spawn location on the path all the way to the beginning of the track.

    The pathfinding logic is fine. Everything that is not "the path" has the solid behavior, and the cloud has "solids" as obstacles in its logic. I used events to see which cells were obstacles and which ones weren't, and everything looks good.

    Here is the problem :

    When you go in the Construct 2 pathfinding example (the one with the green arrow), the sprite is quite small, and it certainly does not collide with obstacles. BUT try to make the sprite bigger, say 60*60, and you can see the arrow overlapping with obstacles all over the place.

    Hence Two questions :

    -What does defines the object's "hit box" when pathfinding ? (the actual hit box, small or big doesn't seem to matter, I tested it)

    -How do I make a medium sized sprite, about 60*60 not overlap with cells marked as obstacles ?

    Here is a visual representation of what im saying, in the Construct 2 example :

    Thank you very much !

  • Hi pose1233 ,

    We are willing to help you, but you will need to help us a little bit too, but posting images, or even better, posting your capx file on the forum.

    If you cannot do this, then you would have to explain precisely your problem, so we can understand what you are talking about. It may seem simple and understandable for you because it is your project, but for us it just looks like Chinese.

    Thank you.