Alon's Forum Posts

  • Hehe thanks to you I still didn't give up on Arrays (yet) ;)

    To your question:

    Since the visual demonstration above won't show all the "rules" of the game, let me try to explain:

    The game will start with 5 items in total.

    As you can see 4 + 5 marked from the beginning of the game as FALSE, means: they won't be found

    The other 1,2,3 marked as TRUE, means: they can be found as soon as you play.

    Once the player collect and item the RANDOM should ONLY look for those that are found = TRUE.

    Now, imagine the Player end a RUN or find a "SUPER SPECIAL MAGICAL BOX" this will trigger one of the FALSE (not found yet) items, and will SET it to TRUE for the rest of the game (saving data) not just for the specific run.

    So you will get a message: "NEW ITEM HAS FOUND!" you just discovered a new one. it should be added to the items the RANDOM can pick now (which I have no idea how to do it of course).

    This is how it should work in theory, but in code? I have no idea.

    Any thoughts? None-Array solution? Array solution that I can... maybe follow? ;)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • OK, as promised... I actually made this visual demonstration in construct (not sure why) it is nothing but text and animated arrows. thanks to my stuuupid visual brain!

    As you can see: I would say that I understand 2D Arrays, it is not the part where I'm lost in again and again but inside Construct's code which is not visual (yes, I did try the Array Editor, no.. it's very confusing to setup so I'm not using it).

    It's probably funny to any of you who thinks: "It's right in front of you visually, translate this to code!" yeah... tried that but again, me and Arrays in Construct 3 I'm not there yet.

    If you'll look at the EXAMPLE FILE I originally attached above this post (please ignore any ARRAYS I put there, can delete it. it does nothing), you can see the "normal" random pickup works very nice (just like in my game) but the part with the FOUND = False / Truth that's where I'm stuck... not sure how to make it work.

    So my question is:

    Is there a way to do this without arrays?

    Any of you for the challenge to help me out? Ashley dop2000

    I tried few things but I failed again and again, still I'm very curious what are the alternatives solutions without using Arrays.

    Thanks ahead for any suggestions, ideas, or even trying to accomplish this task on my example file and post it will be interesting to see how you solved this issue.

  • Thanks for playing with the example file , I just had a look.

    First of all maybe you didn't read the all post where I put the example file because I did mention to ignore my Array stuff, I have no actual idea what I did there I just tried to place them as a start after reading the documents and got even more confused... so it's not the reason I'm confused, the reason I'm confused about Arrays is how I "work" with them on the event sheets, I don't understand it.

    Again, I do understand the principle of 2D array that are Height and Width so I can visual something like shelves with items (X, Y). but that's not the issue as I mentioned above.

    BTW - I DO SEE how powerful ARRAYS now, especially as they deleted on the Debug mode (not that I need this feature but yeah it's wonderful). :)

    I don't understand why you made the player always get stuck with one item only once you pick up the other items, Yes I read what you said which is exactly that but maybe I didn't explain well what I'm trying to do:

    1 - All Items that are "marked" with "Item_Found" = Truth (Boolean I put on my example file SHOULD be able to pickup at any time.

    2 - Once you Trigger (kill a boss, or any other trigger on the game) it will add NEW unlocked items to the RANDOM RANGE (List of all items) by simply CHANGE Items from "Item_Found" = False to Truth.

    So the Items are already exist in the code but cannot be found until they found.

    I'm still not sure if I can explain it better but I tried, this is why my original example is very much close to what I'm looking for, but the UNLOCK part is what I'm trying to add (without Arrays, which are a total unorganized mess in the code for me in person).

    After looking at your version:

    To be honest, I don't understand anything from the re-code it looks like gibberish to me, that is why I suppose I shouldn't use Arrays, I'm scratching my head now trying to understand what's goin on and it looks so messy to me compare to how I did it before (ignoring the Arrays I put there for fun of course hehe).

    Sorry if it sounds like I'm complaining, Actually it's the opposite I'm very thankful that you took the time to re-do this on a file I made from scratch so basically it should be easier for me to understand but unfortunately, my brain cannot understand Arrays no matter what I do I'm blocked (or should I say just stupid) when it comes to such complicated mess of a code (I'm talking about the way Arrays design in Construct is hard for me to follow, edit, tweak, and most of all.. understand and create my own Arrays) so I should probably just give up on the all unlock idea and make my game much more simple... just random items.

    The truth is that I did HOPE that someone will find a way based on my "None-Array" code to solve my issue since Construct can do the same thing in so many ways but I understand that I'm the problem, since Arrays are the only answer and it's unfortunate for me.

    So I'll ask again because I'm really about to give up this wonderful feature I really wanted in my game:

    After anyone can have a look on my EXAMPLE FILE (please ignore any ARRAYS I put there, can delete it. it does nothing)

    My Question is:

    Can you SOLVE the issue I described here and originally on the first post WITHOUT using ARRAYS?

    Is there a super magical secret way to do it?

    If so PLEASE download the example file and show me, I'm extremely curious about it!

    Thanks ahead!

    EDIT:

    Since I didn't gave up on Arrays yet since I'm a very curious person, I will try to make a more simple visual example file, upload to share here and SOLVE the issue thanks to the community help. :)

  • Sorry about that , I didn't see any option to attach to a reply in the new forums.

    The link should work now, can you please try again?

  • Dear and anyone else who's willing to help.

    Since I'm lost in the Arrays Land after many tried I decided to Re-Create from scratch a VERY simplistic version of what I'm trying to do on my game which it's code is so much complex compare to this example file.

    With this file, as you can see it is VERY organized so I can follow and of course anybody else who will explore it, including comments, and dedicated Events and Layouts to separate things like in my actual game.

    Graphics are super basic I made it quick for nice visuals please forgive me.

    Notice:

    If you'll RUN the example file right away, you will notice for the current way I'm using my actual game to get a RANDOM item is very simple, it works visually, it's sticking to the animated character and MOST IMPORTANT: Once an Item is picked up, it will affect the player's properties based on the item's properties on it's dedicated Event Sheet.

    If you'll look carefully on the Global Variables under the Items event sheet, you will notice few Variables that are NOT in use yet: "P1_Poweup_1", "P1_Poweup_2" and "Item_Found"

    The reason I put them there is to put extra options to each item if I want, also to show you that the properties of each Item and future Items can be expand with their own specific rules that may not appear for other items.

    PLEASE IGNORE my Array stuff, I just put it there while have no idea what I'm doing and how to use it from that point so you can ignore it completely as it's useless on the current example file anyway.

    BEFORE YOU START WITH ARRAYS:

    Please, if you can have a look and maybe find an EASY SOLUTION for my original problem which is:

    Spawn ONLY Items that are found (play with the the "Item_Found" if it helps).

    IF YOU CAN FIND A SOLUTION without the Arrays based on the example file I will be extremely happy to see what you came up with, because the current example file isn't super complicated compare to my current game code.

    Thanks ahead, I appreciate your time and kind help!

    Example File:

    Click to Download

  • You can use "Set position to another object" action, it allows to select image point.

    Or you can set position to Head.ImagePointX("pointname"), Head.ImagePointY("pointname")

    Thanks for the fast reply, I'll give it a shot!

  • What does "origin name" mean? If you want to set item to player position, do this:

    Item set position to (Player.X, Player.Y)

    Make sure that items and player sprites are on the same layer, or on layers with the same parallax.

    I must use the the specific origin point of the Player's head, it is animated and holds the Items exactly as the player is animated (Idle, Walk, Attack, etc..)

    But I didn't see any other option to do it as I did on my code before, is there a way to do type it manually?

  • Thanks once again for your mighty patience with me it's so kind of you!

    I didn't read it yet, I will do it carefully and will try to follow of course.

    Just a quick notice about the "NO_ITEM" as 0 on the ARRAY:

    The reason is not just because the game starts with 0 but also sometimes when you lose or have no ITEM, I need to point it to something with default properties, that's how I made it on the none-array way and it worked great... not sure how it will in the Array.

    I will do my best to read and understand it soon, I must give my stupid visual brain another chance with Arrays... since I have the feeling that for what I'm trying to do there is no other "magic" option using a just a random action (I wish there was, it could be so much simple for me to understand and handle).

  • Sprite instances should be on this layout to be able to pick them. It's not possible to pick something from another layout.

    Just copy/paste 5 copies (instances) of Items_common sprite, set correct animations and move them off-screen.

    I just tried it (like in your example file) but I need to set the position of the picked one on the origin name of my Player... is there a way to do it?

  • Dear dop2000, I just had a chance to look at your file, it is VERY visual and very much to my taste but I'm not sure how to apply these simple rules to my game, I got started and I'm stuck so maybe you can help me out here:

    I have a dedicated Layout where I place all the Item instances called: "Item_Common" (I may change it to just "ITEMS" later, the reason is that it's easier to place everything in one layout, and I have it's very own dedicated event sheet that I put properties for every single item as well.

    Also, I think it's much cleaner not to copy past all the instances out of each layout I'm working on, but I'm not sure if I can pick them if they are not on the same layout. (oops?)

    Originally, I just spawned randomly from the "Items" Layout just 1 of the Items:

    1 sprite contains 5 animations, each animation = different item. (the random set the animation, simple)

    The Player spawned to the stage layout (every stage will be a different layout) so I'm not sure if the pick random instance is looking at the Layout? or it looks on it where it is in any layout... explanation how it works please?

    Anyway, I just played with it until I got stuck so what I did is making trying to replace the old "random" choose item with the pick random instance following your example, but in my example it's not changing position (since the Items are not there but on other Layout) so I need to spawn them.

    Is this possible at all? and how? here is my current not-finished code:

    Do you think it can still work consider I need to pick a random instance from a different Layout?

    I hope there is a solution, I really like this visual way you presented to me!

    Thanks ahead!

  • dear thank you very much for your time and trying to help me here!

    So... it's not that I'm scared of Array I just tried it few times, with the Editor, ajax, etc.. and instead of make everything easy and visual as it looked (visual spreadsheet) it was super complicated for me to setup and I didn't even understand how to play with all the numbers around.

    Now, I'm trying again because I guess I have no other choice using a random comment to just ignore or look only on specific items (which is bad news for me) and I'm trying following your instructions but I also try to implement it to my current game... and it is still very confusing:

    From your very first explanation, I did understand the X on Y and I'm not even sure if I need z for depth on my case because I believe 2D Array will do the job) but anyway, as you can see from my understanding I made 0,1,1 because I want 0 = No Item (default).

    It looks just like a nice list on the debug, it was easy to follow and most important to understand that that order I put them on the event sheet is the same order that they will count, so far so good!

    Now the confusing part begins, and I don't even know if I should go there and waste your time since it's probably hard for me to not get how Array works (not the X,Y for 2D array use... but in general).

    Originally I have this: "Items_Common" which is a sprite that contain 5 animations, you can see their names on the image above as I named them exactly on the Array.

    So far everything make sense with the names and the order which is the same on the Array and the Animations.

    So I tried to keep follow you on the part you explain: "To Pick at random you run the action.."

    I do understand that floor (will get the closer to 0) and the random range I guess this is new to me with the 1,array.width so if I got the idea it supposed to pick from:

    1 = the X of the array, "array" is the name of my array, width = the amount of the x (6 total in my case including 0) and it will start from 1 to 6 since we didn't count 0.

    Am I close to understand it so far? I'm not sure that's why I'm asking.

    Once you start explaining: "The number that is returned you can then grab.." is where I got lost.

    I'm starting to scratch my head, OK but where are the properties of each item? how do I control them? how do I see every item's name and property visually on the event sheet and how do I tweak anyone at anytime easily like I did so far without the array... so many questions and confusion just because Array is not visual to me (and I don't like the Array Editor setup, it was hell for me) so I'm trying the good old fashion Array as you suggested, what I see from the array are these items names in a list, so the (variable.0) is ("Item_Number".0) what am I doing with this and how do they connect with my "Item_Number" and I'm not following since there.

    As you can see, Arrays are probably not for my simple visual brain.

    I gave up on Arrays many times because of the same reasons, and once again.. I got lost easily after reading your post few times.

    Please don't get me wrong, I believe that your example and explanation are amazing and 99.9% will understand and follow it easily... unfortunately I'm not that smart and that's why I can't get it and even if I would, it will be so hard to work with such system since it's not visual at all.

    I guess I will have to try some other visual ways, maybe spreading the item instances like the other suggestions since I already have a dedicated layout for items, so it will be the most visual on both the Layout and the event sheet (not sure how to do it yet but I must find a way).

    Once again, thank you for your time I appreciate it a lot!

  • Just add all items to the layout (outside of visible area) and pick one random instance. This is the easiest solution. See my previous comment.

    What's the difference between the random pick I already use with instance in my sprite for each animation? it still needs to look for ALL the numbers and I can't tell it to choose from a specific variable as I explained... so it is not the easiest solution I guess.

  • Thanks for sharing your idea dop2000 I appreciate it!

    My items are on different layout I spawn them when needed, but I have 1 sprite with all the animated items.

    I'm looking for a way to make an event that will use random action to pick ONLY from the items who have the specific variable value of "item_found" = 1

    I'm not sure how it can be done, but for example (in theory only) something like this:

    random("Item_Found=1") 

    I'm aware there is no such code and it's a really bad example but I have no idea how to explain what I'm trying to do with combination of Random + Specific Variable.

    The reason I don't use Array / Array Editor is because I tried it many times, it is super complicated for me to setup, ajax and stuff I don't even understand and not logic for my brain, also it looks hard to find or edit properties especially when not all of my items have the same properties.

    Individual editing my items is much faster, easy to find, and well organized also it's super easy for me to code each item and it's own properties.

    If there is some other solution that is close to what I'm trying to do with a Random action please share I'm very curious about it. Thanks ahead!

  • Hey All,

    Continue to my other thread I'm looking for a solution.

    In order to test this fast I made only 5 items for start for start (I'm not using Array).

    I have 5 items:

    - Every item is actually an animation within 1 Sprite.

    - Global variable: "Item_Number" (initial with 0 which is NO Item by default)

    - When the Player pickup an object called: "RANDOMIZER" (other sprite) it pick one of ALL the items, using a simple random action:

    int(random(1,5))

    So far it picks any of the 5 items like it should, works great!

    BUT! I want to limit the pick by skip some of the 5 items by adding another global variable such as:

    So I added another Global Variable: "Item_Found" 0 = Not Found 1 = Found

    THE QUESTION:

    What event / action I need to make that any Item with "Item_Found = 0" will ignored or skipped by the RANDOM action?

    Also, I'm not sure but maybe I should make the "Item_Found" instance for the item (sprite) instead of global variable?

    Thanks ahead for anyone who can help me solve this!

  • Dear ,

    I would like to test your suggestion but I'm a bit confused, wonder if you can guide me threw this:

    Since I only have only few items at the moment it's easy for me to test (since I'm not using array as I mentioned before) Anyway, I'm trying to following your suggestion:

    1 - Created a new Global Variable: "Item_Found" (Initial 1 = found, 0 = not found yet)

    2 - For every Item I set Item_Found to 0 but only 1 of the items will = 1

    I wasn't sure where to put the new "Item_Found" global variable, feel free to correct me here.

    Now the part I'm stuck on:

    In order to found an Item my game have an object called: "Randomizer" whenever the player's collecting it, a RANDOM Item will appear.

    So far ALL ITEMS are available (can be found) because it works with the "random()" command:

    THE QUESTION:

    Now with the new "Item_Found" variable on every item, How do I make the "Randomizer" to choose randomly ONLY from the Items that are found (Item_Found = 1) ?

    What do I need to tweak on the random action so it will search ONLY items which are: "Item_Found = 1" ?

    Thanks ahead!