mekonbekon's Forum Posts

  • guannstar

    Use the system condition "Compare two values":

    First value: yourObject.Count

    Comparison: equal to

    Second value: 0

    Nest this within a "On yourObject destroyed" condition, so that it only checks when the object is destroyed, not every frame.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • LaurenceBedford

    Here you go, I've updated the capx to include the animations:

    https://www.dropbox.com/s/42lg5xa9johbk ... .capx?dl=0

    There's a separate sprite "npcanim" added to a container and pinned to the initial npc sprite that does the moving. I've set the npc sprite to invisible so that you only see the npcanim sprite.

  • Hi LaurenceBedford,

    If you're using the pathfinding example I posted, one way would be to pin (position only) a new sprite with the npc animations to the moving npc sprite, check the moving sprite's angle and change the animation accordingly e.g.:

    If moving sprite angle between -45 and 45 set animation sprite's animation to "walk right"

    If moving sprite angle between 45 and 135 set animation sprite's animation to "walk down" etc

  • MPPlantOfficial

    Yeah, spawning by name is going to be a real game-changer (literally!) - it's already enabled in the C3 beta if you wanted to give a spin.

    For C2, I believe that Rex Rainbow's "Nickname" plugin and behaviour allow a workaround for calling objects from arrays:

    I haven't tried it though, so I'm not sure how much of a hassle it is to implement.

  • Youtopize

    Glad to be able to help

  • hyem You're welcome

  • Here's a simple example for the npcs walking around using the pathfinding behaviour:

    https://www.dropbox.com/s/42lg5xa9johbk ... .capx?dl=0

    They'll randomly move between 3 locations based upon a timer.

    To interrupt the npcs movement when the player is near use the pathfinding: movement: stop action.

  • hyem As long as you're using the same objects in each layout (i.e. not create lots of new art assets for new sprites etc) I don't think creating more levels should heavily impact the download size, but you can test this for yourself by duplicating your existing level layout in your project (right click on the layout name in the project tab and select "duplicate"), making a build and comparing the filesize to your original.

    Alternatively you could use an array to store the positions of objects for each level and then call each level from the array, but this becomes a real headache as you can't easily call an object name directly from an array (in C2 at least, C3 allows it - yay!) and fixing bugs can be a pain without a visual reference.

    Another approach is to have a single large layout with multiple levels on it and then scroll the camera between them, but it is then harder to reset and pause individual levels and if you have a load of levels on one layout then it will take a while for that layout to load up.

    Generally it's much easier to balance, modify and debug levels from separate layouts, saving you plenty of time in the long run.

  • irwandwiyanto

    If you are using the swap animationFrame/animation method instead of setting to a specific frame use the "choose" expression e.g. set animation to choose("A","B","C") or set animationFrame to (0,1,2,3).

    If you are spawning a new object you'll need to use a local variable:

    On object clicked set local variable to choose(0,1,2,3)

    If local variable = 0 spawn object A

    If local variable = 1 spawn object B

    etc.

  • And read the manual entry blackhornet linked to!

  • ShinjiDammit in your example only the Baddy_Bud that is being created will be affected, as it is the only one that is picked.

    You use the conditions to select the objects to which you want to apply the following actions. For example:

    SpriteA Compare Height > 50: SpriteA Set width to 100

    ...will pick all spriteA instances with a height greater than 50 and change their width to 100. All SpriteA with their height equal to or less than 50 will be unaffected.

    SpriteA Compare Height > 50

    >SpriteA Compare value Animal = "chicken": SpriteA Set width to 100

    ...will first pick all spriteA instances with a height greater than fifty, then from that group all SpriteA whose instance value Animal equals "chicken" and then change their width to 100. All SpriteA with their height equal to or less than 50 or whose Animal is not "chicken" will be unaffected.

    You can use nested conditions like this to narrow down the size of the group that will be affected by the actions.

    If you refer to an object type in the actions without specifying any conditions that pick instances of that object then all instances of that object will be picked:

    SpriteA Compare Height > 50

    >SpriteA Compare value Animal = "chicken": SpriteA Set width to 100; SpriteB Set width to 100

    ...all of SpriteB instances will be affected and have their width set to 100.

    Sometimes, after applying lots of selection conditions to narrow down your group of objects, you may want to reselect all members of that object type in a sub-event; in that situation you can use the system condition: "Pick All".

  • Youtopize,

    I've put together a small demo that explains what I described above:

    https://www.dropbox.com/s/lajf6pr775paz ... .capx?dl=0

    It just loops around between the questions, answers and feedback, but covers the basics. You could simplify this further by shifting some of the repeated actions into functions, but I've left it as is to make it easier to follow what's going on.

    Click an answer to select it, click the feedback to progress to the next question.

    There are comments in the event sheet to describe what's going on, but let me know if you need more details.

  • Hi Youtopize,

    My suggestion would be to use a 3D array, in the following format:

    [Question_1], [Answer_A, FeedbackA, NextQuestion, sanityMod, strengthMod, ...],[Answer_B, FeedbackA, NextQuestion, sanityMod, strengthMod, ...]

    [Question_2], [Answer_A, FeedbackA, NextQuestion, sanityMod, strengthMod, ...],[Answer_B, FeedbackA, NextQuestion, sanityMod, strengthMod, ...]

    ...

    Each X field contains all the data for a particular question; Y0,Z0 = question text; Y1,Z0 = answer A text, Y1,Z1 = Feedback text; Y1,Z2 = NextQuestion; Y1,Z3...Zn = stats modifiers; Y2,Z0 = answer B etc...

    This keeps all your questions and answers together in one array. NextQuestion points to the X value of the followup question for that particular answer. This makes it a lot easier if you want to change the pointer for the followup question or add new questions to the array.

    I would also read up on how to store your array data in a JSON text file and import it with the AJAX object - it's going to be a whole lot easier editing a text file than updating all of those entries directly in Construct.

    Hope that helps

  • irwandwiyanto Adding to tarek2's solution, you can also swap the animation or destroy the first object and spawn the second object in its place:

    https://www.dropbox.com/s/1sd6pvw1iwtkk ... .capx?dl=0

    One thing to be careful of: if you use the destroy/spawn solution and the second object is also set up to swap for a third object, then your initial click may also trigger the second object. A way around that happening is to add an instance boolean to the object (e.g. isActive), and set it to true after a slight delay when the objected is created, then on the check for clicking the object also check if isActive true.

  • markuzz78 I'm having trouble replicating the issue. Here's a capx that uses the initial physics settings and seems to work fine:

    https://www.dropbox.com/s/pzksidy6czai3 ... .capx?dl=0

    If you supply the capx maybe we can get to the root of the problem.