nimos100's Forum Posts

  • Just use a for loop and name your loops

    For "loop1" from 1 to 12000 -> for "loop2" from 1 to 12000 -> if sprite2.animationframe = loopindex("loop1") -> if sprite1.animationframe = loopindex("loop2") -> do this

    I don't see how that would reduce the work a whole lot, but might have misunderstood what he is trying to do?

    But if loop1(10240) = loop2(9020) should do something different than loop1(11002) = loop2(4030) then you would still need to add this to the code somewhere, resulting in a lot of events.

  • Ok,

    I'm trying to create an object and position to another multiple copied objects. I tried adding for each as a condition or sub event for the every tick, but nothing seems to work, some times it only shows on one object for this case is the enemy. Any help is very much appreciated. thank you in advance

    You need to specify which "enemygun" you want where, at the moment in the every tick you set the position of all enemyguns to enemy1 imagepoint.

    This will never work the moment you get more than 1 enemygun. as it will place all of them at the same enemy. You need to either pin the gun to the correct enemy.

    Here is how to do it:

  • Good day. I just want to compare my frames from sprite1 to the frames of sprite2 without having too much events everytime i compare the two.

    Please take a look at my example capx

    http://www.fileconvoy.com/dfl.php?id=g8 ... 4f2b1bb17c

    Think you have to explain in more details what you are trying to achieve with this, if you want help finding alternatives. When looking at you Capx, it seems that different things should happen if for instant (Sprite_1.Animation_frame 1 = Sprite_2.Animation_frame 1) but also if (Sprite_1.Animation_frame 1 = Sprite_2.Animation_frame 2) and so forth.

    But regardless of whether you use | in your condition, if you want different things to happen based on which condition is true, you will need to figure out which frame each of these were at some point and therefore use a lot of conditions.

  • What can affect an "Every Tick" condition?

    Not sure your question make a lot of sense?

    An every tick condition is what happens by default if an event in C2 doesn't have any conditions that would change the rate at which it is checked. By default this is 60 times a second. So when you ask what can affect an "Every tick" condition, the obvious answer would be nothing, as it have nothing that can be affected . But im pretty sure that weren't what you meant with the question, can you elaborate?

  • Hey! I'm making a game (tower defense) and when when I drag a tower over an area and drop it there, it's suppose to spawn a new object on the area(which is a sprite), but the problem is that if it's over two of the same areas, I don't know which one it's gonna land on. Can someone help me?

    The best and easiest way to solve this is to use a pick nearest/furthest action, when you drop the tower on the sprite where you want to spawn it. I guess you have some conditions that when you drop the Tower you want to place, you also check whether its overlapping this sprite where you can place it.

    Now if the Tower overlaps several sprites your pick counter of those sprites is likely to be greater than 1, but since you are also for certain closer to the sprite where you actually want to place the tower than those where you don't want to. You can use the pick nearest/furthest action to pick the sprite closest to the Mouse.X, Mouse.Y.

  • Your problem is with picking, understanding that in C2 is crucial if you want to make anything useful. Luckily when you get it, its really easy.

    This should get you started:

    https://www.scirra.com/manual/75/how-events-work

    Pretty much its all about setting up the correct conditions for your objects.

  • If you think you can make 3-4 games a day and you are happy with the 20$, why would you care about giving him the source code as well, it would make no difference anyway.

    Consider this, if you can produce that many games a day, they have to be fairly simple even if you are good at C2. So regardless of how you put it, the source code have no value, since you could either recreate the games fairly easy again yourself, but it also means that the majority of people here, could also recreate them anyway. So this person can't sell the source code to anyone anyway or at least not for the amount of money that you would have to care about it, I think.

    So if you are happy with the 20$ per game and think you can make 3-4 a day give him the source code as well

  • Random setting of Boolean

    Yet a minor addition that would be handy I think. At the moment you have the ability to Set a Boolean variable to either True, False. But in cases where it should be random, its easier to use an integer. So adding a new action could solve this.

    Action:

    Random Boolean - Would set the Boolean to either true or false.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The audio plugin doesn't seem to have any way to return filenames (according to the manual page). Here's what I'm working with:

    When "On 'tracks' ended" is triggered, I want to prevent the same song from playing twice in a row. Ideally I want it to call a function like so:

    [quote:19xxlsd7]On "tracks" ended:

    --Call function "AudioShuffle"

    --Set Parameter 0 to "(name of audio track that triggered this call)"

    On Function "AudioShuffle"

    If Param(0) and audio are equal, call the function again.

    Else, play (choose(track1,track2,etc))

    Yes, you could do this in a dictionary or array as well (toggle from 0 to 1 for "chosen track" to stop it from repeating), but I would be surprised if there were not a way to do this as the events currently are. Thank you!

    Then you have to be surprised, because there ain't

    As workaround solution instead of your array or dictionary solutions, wouldn't it be easier just to make a list (playlist) and add all your tracks to that and use that as your input string for your audio object. That way you can always make a check vs "text at selected index" to make sure that the same track isn't played again.

  • When i create this 3 levels with 6, 10 and 20 cards and when create last 10 pairs how level 1 and 2 will be working if game dont should have too many cards?

    My example simply shows how you can make it fairly simple using a fixed amount of cards. If you need more cards or more flexibility you will have to adjust the code for that. Its only meant as a starting point or to give you some ideas.

    If you need different amount of cards for each level you have to change the code so it can do that. Because you are right the current code doesn't work if the amount of cards changes. The reason for that is:

    Event 4: Here we add all cards in the card object to the list 2 times. So we can assign them to the cards that we place on the table in Event 6 and 7.

    Event 6-7: But here is the problem as we create the cards we also assign them a random card from the list. But if we only need 10 cards to be on the table but have added 50 different cards to the list for it to choose from. The chance is that we will end up with none matching cards.

    So to fix it, we have to be sure that only the needed amount of cards are available in the list and that we don't add more cards to the table than we have cards for.

    To make it easier to work with I add a function that will handle that for us.

    Its always a good idea, I think whenever you create a function to write with comment what the function need to work.

    So at the top you can see, it requires:

    "Needed cards" - This is the total number of cards needed. So 10 for instant means we have 5 cards with 2 of each type, so they match.

    "Cards_in_X" - How many cards should be in the horizontal direction. So 5 means you will have 5 cards in a line.

    "Cards_in_Y" - How many cards in the vertical direction, so we could make that 2 so you would have 5 cards in each line and 2 rows. Which equal 10 cards.

    Event 18: Since we added all cards in our game to the list in Event 4. We might have to many cards in the list for what we actually need. So the first thing we need to do, is to make sure that we only have the correct amount of cards to choose from. So we check whether the "Itemcount" in the list is greater than what we need. If that's the case we need to remove some cards from it. So we choose a random card from the list and store it in the variable "Card_to_remove". The reason to do this is because we added cards twice, so we also need to remove two entries from the list.

    Event 19: And we do that here by going through the list and remove all the cards from it which match this "Card_to_remove".

    I have a total of 10 different cards in the game. So if I use all of them, the list would look like this:

    Imagine that I only wanted to use 6, then the list could look like this:

    So now we can remove cards from the list and only end up with the ones we need.

    Event 20 - 21: These are the same as in the original, except that we use the "Cards_in_X" and "Cards_in_Y" to decide how we want the cards to be arranged.

    So we use the parameters (1) and (2) which we use when calling the functions in the loops to decide that. The reason I subtract one, is simply to avoid having to think about the 0 index in C2, when calling the function.

    Event 6: Now that the function is made we don't really have to think about it anymore, all we have to do is to make sure that we call it with the correct values. In this case we want 10 cards, 5 in each line and 2 rows.

    So as long as you don't go higher than what you have cards for in the game and you make sure that when calling the function this is true:

    [Needed cards = Cards_in_X * Cards_in_Y]

    Then it will work.

    CAPX - https://dl.dropboxusercontent.com/u/109921357/Simple_match%20game%20tut%20files/Simple_match_game.capx

  • nimos100 yes i set new row for more cards and that thing happen

    My guess is that you have added to many cards, because it should work.

    After you run the game and all the cards are on the layout, are the list empty? if it ain't its because you added more cards than you need.

  • nimos100 wow, thanks for your initiative, im wondering how make game with 20 cards on screen

    i add other card colors but not alwys card matches, sometimes i have last card with no pair

    After you have added the extra 5 cards, you go to Event 7: For "Y" 0 to 1 and you change that to For "Y" 0 to 3

    Remember the index starts at 0. So For "X" 0 to 4" = 5 which are the number of cards in the X (Horizontal) direction. So to get 20 cards, we need to have 4 rows in Y (Vertical) direction, because 5 * 4 = 20 , therefore you need it to be 0 to 3, because that's 4.

  • Its a bug in C2 it seems, these two conditions are not normally able to be used together. However it seems that C2s "validation check" only apply if you drag the "every x seconds" to the "On timer event". However no validation is made if you drag The "On timer event" to the "Every x second" event and then it apparently gets bugged and think its an "Is between angle" event

    You should post this in the bug section.

  • Here are some tips:

    1. Original size, will give you the best quality because you will neither add or remove pixel information. However if you need small but somewhat detailed images, this might not be the best way to go.

    2. Scaling down, can be a good idea as it can be difficult to draw a lot of details in a 32x32 sized image. So you can make the image larger say 128x128 and then scale it down. Since you are scaling down its more difficult to see the loss of details from the original sized image. Therefore it can be done. Imagine a picture of Mona Lisa at 1024x1024 and you scale it down to 32x32, then you need 1048576 pixels that made up Mona Lisa in the original image to suddenly be represented in 1024 pixels. So logically you will loose a lot of details, but since you are scaling down, the new image is so small that you can get away with it.

    3. Scaling up, if possible I would avoid doing this, but if you have to, you really need to scale by a small amount, especially if your original image is small to begin with. It will pretty much have the opposite effect of scaling down, because as you scale up its also easier to see all the errors since the image gets larger, which is because you are adding pixel information that ain't available in the original image, therefore you get this stretched, fuzzy/smooth look as it tries to compensate for these missing information. However if you original image is somewhat large to start with, you can get away with more scaling up.

  • The answer seems to be no but I figured I'd check first. Perhaps this can be a feature suggestion if it's at all possible to implement.

    Anyway, is there a way to apply the wrapping function of the Wrap behavior to other behaviors? So for example, have Pathfinding walk off the edge to wrap to the other side to take a shortcut? Or have LoS behavior spot an object on the other side of the layout by looking towards the edge?

    There are no way to do this with the current behaviours, simply because they weren't designed for it. But you could program your game to work like that if you wanted, might not be easy but think its possible.