Alon's Forum Posts

  • Hello All,

    I'm trying for the first time in my game to work on a smarter enemy than my basic one.

    The idea of making a Machine State make sense to me so the enemy can change his state and animation from one to another.

    So far so good, But since there are many ways to do so I have the feeling I will go lost very soon and will have issues even that I'm very organized in my event sheets, so I would like to ask you if my idea is more complex than it should be or not.

    My Enemy actions, states I will need to play with including animations:

    - IDLE (stop)

    - PATROL (wander, until sight of view is overlapping the Player then change to "ALERT" state)

    - ALERT(stop, when "Ready to Jump" animation is finished: change to "JUMP" state)

    - JUMP (Simulate JUMP, change to "ON_AIR" state)

    - ON_AIR (2 frames loopable as long as the enemy is on JUMP or FALL, not on floor)

    - LAND (stop for a second) change to "IDLE" state) and loop the all state machine again and again..

    Inside my head it works great, but I know it will have issues since I never done that in C3 yet.

    First, I'll make the state machine I'll use strings on instance variables for the enemy.

    Questions:

    1. Do you think this should be done using GROUPS, each group will contain the actions I described above using enable/disable all but one at the time? because I rather have this all thing very organized so I can follow.

    2. From your experience: Do you have any suggestions to make it work with no issues I may ran into?

    Thanks ahead!

  • You do not have permission to view this post

  • I'm not sure if I understand exactly, so I tried something like that:

    I even tried this: (got rid of the sounds to make it easier to follow)

    As you can tell I'm already lost and confused... I have no idea how to fix this mess.

    I'm so close, just need to figure this out and the system I designed should work for the game.

    Any ideas, changes I can tweak will be very appreciated and helpful.

    Thanks ahead!

  • That should work, I don't see the need for the pop event though so that can be removed.

    With or without the pop event I get the same result.

    Any alternative ideas for solution?

    I'm stuck :(

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • UPDATE: I almost got it to work!

    I Re-Shaped the all thing, renamed the variables so I can follow etc..

    THE ONLY THING that isn't working for me is once an Item Moved from the "arr_Items" (default Items) to the "arr_Items_LOCKED" (Unlocked Items) the item that picked and moved is NOT DELETED after it moved.

    On the Debug: when I press F6 it moves any of the 2 unlocked items randomly which is GREAT!

    But it won't delete so I if I keep pressing F6 it will keep adding them to the list.

    Can someone please have a look at the CODE maybe point me how to fix it? I probably missing something or did some error... just when I started to like Arrays.

    HELP please? :)

  • OK, I think I'm almost there... but I don't know how to code the RANDOM pick from the 2nd Array to the 1st and remove the one that picked.

    Here is what I got so you'll have an idea and hopefully can guide me through:

    Above are the Items we begin with "Arr_Items" - All items that can be found by default:

    Next is the trigger: Pick a random NEW ITEM from "Arr_Items_LOCKED" and add (push) it to "Arr_Items", Then, Delete that picked Item.

    I don't know how to do that yet, but I did some progress.

    The Debug shows that both Arrays are set EXACTLY with the items I chose, so at least I got that right:

    please help? :)

  • Thanks for the quick reply it sounds like a great solution!

    So if I got the idea:

    1 array for the normal Items who are already found by default, and 2nd Array for the NOT-Found-Yet Items.

    Then push from the 2nd Array list to the 1st one and delete it from the 2nd one.

    It make sense in my visual brain, I can see it "moves" from one to another but I'm not sure if I can accomplish it in C3 yet, Sure I must try it for the learning experience.

    If I'll get stuck, I'll ask for help.

  • On my journey of trying to get used to Array which I always ran away from... thanks to I could finally add a basic working Array to my game.

    Based on the GIF, as you can see the idea is whenever the PLAYER touch that cube-sprite on the left, it will add (push to the Array list) a NEW ITEM to the game which is what I want for my game: something to TRIGGER a NEW ITEM FOUND!

    and add it for the game (even if you quit it, I will learn and use how to SAVE later).

    I used the CHOOSE and put 2 "NEW" items like this: (Items that are not found yet by the player)

    Debug: EVERYTHING Works great, as soon as the player collide with that sprite it's destroyed and one of the two NEW Items will be added to the Array "Arr_Items" list.

    But THE PROBLEM is: next time when I want to add different ITEMS, it may still choose one of the ITEMS that already added.

    MY GOAL: Once a NEW ITEM is added to the Array list, I want NO MORE of this item to add in the future

    The GIF shows an example of what will happen if the PLAYER will FIND A NEW ITEM during a full game.

    I'm aware that the problem is CHOOSE because the names are there to choose from and I can't remove them once chosen... or maybe I can? (it will solve the issue)

    So is there a way to make sure, once an Item added to the list it won't be added again?

    so I won't get huge list with the same Items.

    Have a look:

    Please understand, not only I'm new to Construct 3 but also ARRAYS are new to me and I'm trying my best to learn and understand how it works in C3 while practicing. so far I'm VERY impressed from the powers of Arrays!

  • I had to try implement this Array to my actual game and do some tests, so far everything works great!

    But now I have this issue, maybe it's simple to solve using some Array action?

    I created a simple sprite so I can test NEW sprite added to the list.

    Once the Player is colliding with this sprite it's adding a NEW Item. (push to the array list)

    I used the CHOOSE and put 2 items like this:

    Debug: EVERYTHING Works great, as soon as the player collide with that sprite it's destroyed and one of the two NEW Items will added to the Array "Arr_Items" list.

    But The problem is... next time when I want to add different ITEMS, it may still choose one of the ITEMS that already added.

    So is there a way to make sure, once an Item added to the list it won't be added again?

    so I won't get huge list with the same Items.

    Have a look:

  • I'm not sure if it's possible but I would like to know:

    1 - Can I PAUSE specific Layer Names for few seconds? so EVERYTHING on that layer will be affected.

    if yes please explain how.

    2 - Can I PAUSE ALL Layout but choose which objects to ignore the Pause? (instead of pausing every single object in the code)

    Thanks ahead!

  • Ah okay, because it's a text variable it needs to be if equippedItem = ""

    On event sheet for stage 1 you set it to "" so that needs to be the check, or you can change it to NO_ITEM, doesn't really matter.

    Your original code was: equippedItem = "" and it didn't work.

    I tried to change it: equippedItem = "NO_ITEM" (I double checked so it's like the Array with caps)

    None of them are solving the issue, when I restart (F5) the player still have the latest states.

    EDIT:

    I Managed to fix it, I had another equippedItem = 0 (which doesn't make sense since it's string) so it was ignored.

    I'm keeping on practicing and playing around with this most basic Array, thanks to you I appreciate your help and great explanations.

  • Thanks I will read it.

    I've noticed an issue with the latest example, and I don't know how to fix it because... Arrays are still new to me.

    When you start a new RUN (F5 should simulate the same idea) after you already picked an item with SPEED or HIGHER JUMP the latest states will stay even if you restart the game with no item.

    What is the solution to reset it to actual no item (default settings) like I put on one of the groups called: "NO ITEMS - DEFAULT"

    I've tried:

    System > On start of layout > System | Set euippeditem to 0

    it didn't solve the problem, no change at all.

    1. Should I put it on the Array as one of the options?

    2. or there is a different Array action I can add within start of layout?

    3. Will this get RID of all the new items added to the array? (not supposed to if I will SAVE)

  • Key presses are triggers that trigger once without the need for adding a trigger once. The key press I added is in place of what would be your logic for unlocking the item.

    So if in my game it will be triggered by collision, overlapping or anything else (I don't know yet) so it won't add more than once by accident? I must be careful since I will add many items to found.

    What is the the best way (I know there are few) to SAVE and LOAD my game so it won't save the player's position or let him start with the last item.

    I may do only 1 slot or more for saving and RESET the game (all found items will be gone)

    All I want to save is the FOUND items, or should I say the most updated Array list?

    Can you please give me some advice on this subject?

  • Thanks for the detailed explanation I think this file is helping me to get the basics of how to work with the Array, I just added the actual "Helmet_Gold" added the animation, the item followed what you did there with it's name on "equippeditem" variable, etc..

    Great advice, I just used the Debug to see how it adds (push) to the end of the list no matter if it was Purple or Gold Helmet the first added.

    I just realize it will be impossible to check my arrays once I'll have many items which is my original plan for the actual game.

    The problem I ran into was, even when I added a sub-event with "Trigger Once" I can keep adding more and more Helmets to the list, and I know in my actual game I will use some creative triggers so I better know how to make it add only once.

    Any idea why "Trigger Once" not affecting this?

  • YES!!! This is the direction

    Since I don't just want to copy past this to my actual game, I would love to try understand how it works.

    But the problem is that... it's not visual at all, so maybe you can try to explain or draw it roughly?

    You can use arrows on my demonstration or something it will sure help me SEE it:

    In your version, I don't see which item is found and which isn't I'm guessing that you only set the 3 first items on the start layout while the others, are triggered using the '1' and '2' keys but I can trigger them in any way that I like of course.

    1 - The Purple and Golden Helmets which are "Not Found" by default, are not exist on the Array at all, right? or I missed that part. if so... where did you set them before you pushed them back? (confusion mode)

    2 - So if I will make 100 Items now, will I populate ONLY the "found" items and will PUSH BACK those who are not discovered yet? I wonder if that's the principle of what you did in the code.

    3 - I don't understand how the PUSH works exactly (documents are too general and not visual for my stupid brain) Can you explain? are they PUSHING "Purple_Helmet" from specific X,Y ? if so... from what place to what place.

    All I can guess is that pushing back should move -1 on the X, and if I'm correct... where is the "Purple_Helmet" on the first place? maybe I missed it in the code.

    Thanks ahead for your MIGHTY patience with me, I admire you and very thankful!