nimos100's Forum Posts

  • Think you can make all the objects on the layouts global, that will not destroy them on "end of layout". However havent tried it a lot. So not sure if it can do what you need.

  • Not sure if this helps or not.

    But personally i think its a good idea in the event "on start of layout" to destroy all objects that you are not using. Just to make sure that you dont have rogue objects screwing things up suddenly. So if you have a main layer where the game take place, simply pick all <objects> and destroy them. And then add what you need with the system -> create object afterwards, if you need objects to be on the screen at the beginning of the game. The one object that is not moving might be due to it being a "rogue" object.

    "How can I set certain nemos to be placed and move in certain areas"

    Not sure if it fits your design, but a way you could do it, is simply to add a tracing sprite of each area, and setup the collision points so it fits it.

    Then add an ID variable to the Nemo object, called "Area_ID". As you create you Nemo objects, you add the UID of the tracing sprite to "Area_ID".

    After that you can add an event, that if Nemo objects with Area_ID = <Tracing UID> is not overlapping Tracing sprite then change direction, or what they have to do.

    And how can I after they are destroyed to spawn at the correct spawner object?

    If the above works for you design, you can simply let the Tracing sprite spawn the Nemos, and since its already picked if it spawns the Nemos, you can very easily in the same event set the "Area_ID" of the nemos to that tracing sprite.

    Hope it helps or at least give you some ideas :)

  • Hi Waffle

    I have looked at your capx. And if i have understood you correct, you want the Ghost to trace a route for the player to the correct exit?

    If thats the case there are some problems with your program.

    1. I dont think that "Find path" works in the "on start up event".

    So instead you can add a boolean variable to the ghost and call it "Tracing" or whatever and set it to false by default.

    Then add an event that if "Tracing = false" Then "Set Tracing = true" and "Find path(X,Y). Then if you want it to run again you can simply move its to the start position and set the "Tracing" variable back to false.

    2. The size of the ghost is way to big for your maze. The maximum size that you can use is 9, for both width and heigth and the cell size.

    An idea that might make it a bit easier, is to use a sprite instead of X,Y values when you use "find path", So if you make a sprite called "Ghost_target" for instant and then in the find path, you can simply write "Find path("Ghost_target.X, Ghost_target.Y")" then you can move it around on the layout or runtime without having to update your X,Y values each time.

  • For those that cares.

    The first example i did in the beta release r110, and couldnt get it to work.

    I now downloaded the lastest stable version r108.somthing i think. And now it works.

    So guess there might be a bug in the beta release or something.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • i just tried it, but it stills just return 0 :(

  • Hi

    Have a probably simple question regarding arrays, as i started looking at them and how to use them.

    So i read the manual part about it and some tutorials about how to add values to them. But no matter what i do, i cant seem to get anything but 0's out of it. Even when i try other peoples examples of how they did it, when trying to help someone else, there examples still just return 0.

    So maybe someone can explain it for me.

    I made a 1 dim array with 10 width.

    I use:

    for each X element

    • Array | Array set value at Array.CurX to 1
    • Text | Append Array.At(Array.CurValue)

    It returns 0 for all.

    I have also tried using CurX in the append text, but it still returns 0.

    Anyone know what im doing wrong?

  • Ahh ok i see.

    Thanks for clearing it up for me :)

  • So if i understand you correct it just doesnt work in a subevent, due to that?

    I have no clue how the overlapping check is done, but thought that it was done by taking each instance, in this case only the newly created one and just go through each of the elements that its told to check for overlapping and see if its true or not.

    But if i understand you correct its done in some way where it picks 2 instances that are overlapping and then return true, and since it only picks one instance in my subevent it will always return false?

  • For those that cares :)

    I did some more testing of this, trying to figure it out. And based on the article - "Understand the picking of newly created/spawn instances since R101" I cant see why it shouldnt work as its pretty much an exact copy of that. But for some reason the newly created instances doesnt seem to work with the overlapping test, when its added as a subevent. As im setting lots of other values as part of these subevents which works fine.

    However if you move the overlapping test into its own event it works fine, and do some workaround, i think you can get it to work kinda the same way.

    The purpose of this is to make a part of a random map generator that add X amount of different graphic elements to a map, but at the same time makes sure that if these elements are not overlapping, they are destroyed and a new one is made.

  • Hi

    Think you can do it several ways.

    If you give all your weapons an ID, so pistol = 1, Rifle = 2 etc. Or just strings whatever you prefer. And then store that value as a global variable, like "Player_active_weapon", then you could simply check on layout startup, what value is in "Player_active_weapon". And set that weapon to active on the new layout.

    A way that would work i think, is if you make an empty event sheet and call it "Player stats" or whatever, then you can add all the player stats like health, weapons, ammunition or whatever you need in there. These values can be used in any layout you have. That way you can simply update that event sheets variables everytime the player interact with the surrounding.

  • Have a quick question about overlapping, that i hope someone can explain to me.

    So i have this event:

    X = 10

    Event:

    For 1 to X

    Spawn family1 at random(1000), random(1000)

    subevent:

    family1 is overlapping family1

    family1 destroy

    add 1 to X

                  

    However they are still ending up overlapping at some point.

    I read in the tutorial section about picking newly created instances, and i cant see why this shouldnt work, as the newly created family instances are within the scope. Anyone know what im doing wrong?

  • Hi got this while copy/pasting an action. It was a System -> Set value action that set the value of a local variable, if that helps.

    ---------------------------

    Construct 2 Check failure

    ---------------------------

    Check failure! This is probably a bug:

    Creating deleted status undo point with no elements

    Condition: !project_elements.empty()

    File: Undo.cpp

    Line: 62

    Function: __cdecl ModifyDeletedStatus::ModifyDeletedStatus(const class std::vector<class ProjectElement *,class std::allocator<class ProjectElement *> > &,bool,const class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &)

    Build: release 105 (64-bit) checked

    Component: Construct 2 IDE

    (Last Win32 error: 0)

    You are using a 'checked' release of Construct 2, intended for testing, which causes certain errors to be reported this way. Hit Ctrl+C to copy this messagebox - it's useful information for the developers, so please include it with any bug reports! Click 'Abort' to quit (unsaved data will be lost!),'Retry' to turn off messages for this session and continue, or 'Ignore' to continue normally.

  • Yeah but each family can have X number of objects which have an variable called the same but with a different default value.

    If you make an instance of an object it should get the default values of its parent.

    So if:

    object A: I = 10

    object B: I = 15

    and are in the same family.

    so if you make an instance of object A as far as i know, it should inheritance its I value.

    So if you change object A I value, newly created children of that object should get that value as well.

    As far as i see it, its no different in construct 2, there is just not a function that allows you to specify what "family member" you want to create.

    But i might be wrong, but i cant see why there should be a problem in changing a parent object default value, just because its part of a family.

  • Its a bit weird, anyone that works with families must run into this problem at some point, if they ever want change a value in that family, before creating them?

    It would be nice with a create family object, where you could specify which object in the family you wanted to create. That way you would be able to do it, as far as i see.

    I can set the value if i use pick nth instance i want when assigning a new cost, but it doesnt work with the create object unfortunately.

    I think i might run into a lot of problem later on if i use an array like you did, and it will make the project really messy, with so many buildings array which i cant keep track off.

    Ill try to see if i can make a work around for it.

    But thanks for the help.

  • Hi Kaisirak

    They are familiy variables.

    I tried your building.capx and modified it so it matches my situation.

    Modified buildings

    if you press "1" it will just spawn a goblin at 100,100 and then subtract its cost from credit.

    which works fine.

    If you press "I" it will now just set cost of all buildings to 5. But when you press "1" it will correctly check for the new cost value, but it will still subtract 10 from the credit.