Alon's Recent Forum Activity

  • 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).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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!

Alon's avatar

Alon

Member since 20 Feb, 2014

None one is following Alon yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies