mekonbekon's Recent Forum Activity

  • 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

  • Try Construct 3

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

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

  • overlimit1 Check again: - the collision box of the first frame fits, but the boxes for the rest of the frames are all set to the full size of the frame, which is why your sprite floats in the air - is there any reason why the frame needs to be so big? If not I would recommend doing the following:

    1) Go through and crop each frame using the crop tool in the editor (hold shift and click the crop icon to crop all frames in the animation) - this will save you a ton of space.

    2) Place the origin point at the bottom of the frame and apply to the entire animation (select the origin icon and right click "origin" in the origin pop-up window to access quick assign to bottom and apply to entire animation).

    3) Make the collision box a rectangle (instead of a polygon) that approximately covers the sprite and apply it to the entire animation - this will help prevent weird collision bugs due to the collision changing between frames/animations.

    An alternative technique is to create a separate invisible sprite that you use for collision checks and pin the other sprite to it - you should be able to find examples of how to do this if you search the forum and the tutorials.

  • aaronfranke Maybe something like this:

    Create a global variable

    For each condition that you're testing:

    when true, trigger once: add one to global variable

    when false, trigger once: deduct one from global variable

    If global variable = 5: do your thing

mekonbekon's avatar

mekonbekon

Early Adopter

Member since 9 May, 2014

Twitter
mekonbekon has 13 followers

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

18/44
How to earn trophies