nimos100's Forum Posts

  • Is between value picking

    This is just a minor thing, but it would make sense if the "system -> Is between values" were also available as a picking condition for objects.

    Since you can pick objects based on variable values, it would be nice if this were also a possibility without having to use other picking conditions.

  • > You can turn your Rooms into global objects, you do this in the properties panel, top left corner. Then they will be available in all your layouts.

    >

    Oh! I have to try that. I guess the UIDs are saved between the layouts, so I can access every object with the same UID through the rooms. Thank you, I will reply when I try it. Thanks in advance ^^

    Yeah its the same object from once its created with all settings etc.

  • You can turn your Rooms into global objects, you do this in the properties panel, top left corner. Then they will be available in all your layouts.

  • You are stretching the image?

    If you have 5*6 pixels in your image you have a total of 30 pixels of color information, if you stretch those to a 100*100 image you suddenly have 30 pixels of information to cover 10000 pixels so your image get stretched. Make the original image in the image editor match the size you need in the game and it wont stretch

  • > Part of the problem is that you have duplicated all of the events. Now someone has to go through each to compare what might be different. This is the wrong way to do it. You don't want to do everything 3 times. Just do it once, with the differences isolated to each level.

    >

    i check this and update

    each evens sheet is fine for each level

    but cards for other levels are no shuffled

    thats is bug i dont understand

    Looked at the tutorial and it seems a bit complicated for what you are trying to achieve, so made a very simple example of how you can do it, which might be easier for you to work with.

    Here is a detailed explanation of the code and how it works and why its made the way it is, then you can always extend it to what you need.

    1. This is the basic layout, a list that hold the card frames. These are the actual image frames found in the card object.

    2. A card object, the image is the back of the card.

    3. Opening the card sprite in the editor, you can see it have 6 frames. The first frame (0) is used as the back of the card and then there is 5 different colours. These would be images in your case, I just use colours.

    4. There are 3 global variables which we will ignore for now.

    In event 3: I do some clean up, its always a good idea to remove objects (Sprites) that you don't need to be there in the beginning of the game. In this case, because I know I will generate 10 cards, so I don't want a random card floating around causing problems. So I destroy all cards before anything else.

    Event 4: Since its a matching game, I know there need to be 2 of each card somewhere in the cards. Therefore I use a repeat 2 times.

    Next I add each "animationframe" in the cards starting from 1 to 5. If you look at the above image you have the backside of the card at frame 0 and then all the cards from frame 1 to 5. I use the "AnimationFrameCount - 1", because C2 counts the total number of frames to be 6, since the first index starts at 0. But I need the highest index to be 5, therefore I add -1 and make the loop start at 1.

    Once that is completed you have a list like this:

    So two of each number from 1 to 5.

    Event 6-7: We generate the card layout, by making two loops and add some numbers so we get the correct distance etc. The first loop (X) goes from 0 to 4 because I want 5 cards in each row and the second (Y) from 0 to 1. Remember that C2 starts at index 0, so 0 to 4 is 5 and 0 to 1 is 2. 5 * 2 = 10 cards.

    As we generate the layout we also choose a random index from the list which hold the pictures index and assign it to each card, and then we remove it from the list so it can't be chosen again.

    So now we have our random cards nicely on the layout. So now to the player turning cards and to see if they match.

    So first of all I have added a Boolean variable to the card object, called "Turned" this is done so we can easily select the cards that the player have turned and to make sure that the player can't actually turn the same card twice.

    Event 9: So if the player click a card, which is "Not turned" it will execute the code and the "Number_of_cards_turned" need to be less than 2, to avoid players turning to many cards.

    So the first thing we do is to set the "animationframe" of the selected card to frame we assigned to it when we created the card. And then we add one to the global variable "Number_of_cards_turned" Which keep track of how many cards the player have turned so far.

    Event 10 - 11: Since the player must only turn a maximum of 2 cards, we check to see whether its the first card or the second card that is currently being turned. And we store the picture value in the global variables called "Card_picture_1" or "Card_picture_2", the reason for this is that its much easier to compare values this way than to compare two identical sprite objects.

    Next we mark the cards as being turned.

    Event 12: Here we simply check if the player have turned 2 cards. If that's the case we wait 1.5 second so they have a chance to see what the second card they turned were.

    Event 13: This is where we compare if card 1 and 2 are the same. If the Global variable "Card_picture_1" and "Card_picture_2" are the same then we know that the cards also are.

    If that's the case (Event 14) We need to remove them. But first we have to reset the picking, because we started the whole event by picking a card based on whether we left clicked it or not and whether it was turned. But that wont work here because we need to remove both of the cards, therefore we use a Pick all Cards, which will ignore any former picking we did and then we can set up new conditions. So we then say that it should pick only the "Turned" cards, which are the two the player clicked and then we destroy them.

    After that we reset all the variable back to their default values, so the player can choose again.

    Event 15: (Else) If the two turned cards are not the same, we don't want to destroy them but simply turn them back around again. So as in Event 14 we reset the picking and choose only the "Turned" cards. Set their "animationframe" back to 0 so its the back side of the card showing and then reset all the global variables.

    And then you have a working match game

    Here is the CAPX so you can try it out:

    https://dl.dropboxusercontent.com/u/109921357/Simple%20match%20game/Simple_match_game.capx

  • too much to print screen;) i delete most addons now

    > You use addons in your project, so unless someone have those installed or are willing to install them I doubt you will get help Can you post screenshots of you code instead then it might be easier for people to help you.

    >

    There are three addons, called "Authentication", "Parse initialize" and last one is "Leader board".

    Im not saying it to be annoying

    Ps. You shouldn't delete random addons if you need them. Just make sure that those in your project are removed, either by saving another copy of it without them. that way you still have the original version that you work in. And I don't mean you have to delete them from you C2 plugin library just make sure that they are not used in your project.

  • You use addons in your project, so unless someone have those installed or are willing to install them I doubt you will get help Can you post screenshots of you code instead then it might be easier for people to help you.

  • Lol, you know that we have almost 700 pokemons? In that way i have to do it 4200 times, is the only way to do it?

    But the only thing to really keep in mind when designing your game is to take something like this into account, so for instant how do you organize or design a pokemon object so it can handle that many in a way you can work with it.

    It is unfortunately one of the lesser good things about C2 in my opinion, the bigger and more advanced your game become, the more you will notice the lack of tools for helping you manage and working with huge projects, its really on a minimum I think. But after a while as you loose control over bigger and bigger projects and scrap them, you will eventually realize that organising and really design things to be able to handle stuff you might add later is crucial for any big projects or they will most likely fail.

    Here are 2 tips for you:

    1. Do a lot of small independent tests - Analyse you game for elements where you assume problems might occur, obvious this is easier the more experience you have, but for instant if you know that you will need a lot of different units types in your case 700, how can you design such object so you can work with them efficiently, its definitely not a good idea to make 700 global variables to keep track of them, so how do you get around that? And you do this as a separate project simply to test whether its going to work or not, so don't add it in your final project and its best to do it before you even start the project.

    2. How do you organize a project so you can find things - In my game Dragonhelm in my description (Which is now abandoned) there is 5657 events. Now imagine finding a specific function or event, if you might not remember exactly what its called, or if you notice a bug in the game, but which event actual caused it?. So spending time on making a system so you know exactly where to look for things is a must. A good idea would be for instant not to mix functions and other types of events etc, but whatever works for you. But this is where C2 really crumbles in my opinion, the lack of tools for helping with this, you are really left with this almost alone.

  • You can't create objects using a text string, so you have to make a condition first then use the create object.

    Example:

    Object_to_spawn = GVpcSlot1
            Create object butterfly
    
    Object_to_spawn = GVpcSlot2
            Create object Cat
    
    Object_to_spawn = GVpcSlot3
            Create object Dog
    [/code:1jhnpopb]
    
    So use your global variables as tests in your conditions and based on that create the correct object.
  • [quote:1w6l5982]I just made 3 more families - LgDisk, MdDisk and SmDisk. So i should be able to change and add 2 more events for - System - For each LgDisk/ MdzDisk/ SmDisk.

    And forgive me

    nimos100

    , i'm not understanding your text1.text = str(object_1.Pin.pinnedUID)

    Can i trigger that with - LgDisk > On Created?

    Sorry was just using a textbox as example.

    My point were as you pin one object to another, the object that you pin the object to can be received, since that is the case you can get the size and thereby add the correct score.

    Here is a simple example:

    https://dl.dropboxusercontent.com/u/109921357/Get%20pinned%20UID/Get_pinned_UID.capx

    If you click one of the stars (Blue circles) you get a text showing its UID and the UID of the disc that its pinned to as well as the size of the disc. Which if I understood you correct would decide the score.

  • You can get the pinned UID when you use the pin behaviour.

    For instant:

    On start of layout
          Pin object_1 to object 2
    
    On key pressed 'A'
         text1.text = str(object_1.Pin.pinnedUID)  <-- (Will set Text1.text to the UID of object2, you can use this to pick the correct disc and then get the correct size/score)
    
    [/code:1v4hxh6y]
  • Not really sure there is a best way to integrate music files. You could try to reduce the bitrate on import. If its because you don't want to wait for the loading. You can use Audacity and cut out a section that you can use for testing while making your game and when you are done copy over the correct audio file. At least that way you can add the music and test that it works etc.

    Another solution is to make a variable containing the audio file name and just change that around from the test file to the correct file when you are done. Obviously you would have to add the variable name instead of the audio filename the places where you used it with the audio object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can turn the objects global in the properties panel. This will make them stay between layouts.

    An array should be global by default as far as I know.

  • [quote:1l7ubrr1]What I want to do is to use a variable as an object in expressions, for exemple, in my game I have a variables that contain the name of the Hero the player choose for the A slot, another with the chosen Hero for the B slot (etc for C and D). So one variable per slot : ChoixHeroA / ChoixHeroB / ChoixHeroC / ChoixHeroD...

    Here what I want to do ( would make 4 events only : one per slot) :

    lerp(self.width, (ChoixHeroA.POWER/ChoixHeroA.POWER_MAX)*BarrePOWER_A.LargeurInitiale, 5*dt)

    Here what i have to do ( make 40 events : 4 slots x 10 hero) :

    lerp(self.width, (HardcoreGirl.POWER/HardcoreGirl.POWER_MAX)*BarrePOWER_A.LargeurInitiale, 5*dt)

    Nice graphic and idea for a tower defence

    I think your problem is in your object design, so you should be able to fix it by thinking about your heroes a bit differently. Meaning that your heroes share a lot of common attributes and functionality, Like health, they can move around and so on.

    Since these things are shared, what you can do is look at all your heroes as being the same object type, except with different values, such as name, damage, movement speed and so on.

    So you can solve it several ways. Either you can make one hero and make a unique identifier such as a name variable and use that whenever you have to work with a hero, like this:

    //Require: 
    //Hero.Name
    
    Function Power   (Just a function)
    Pick Hero.Name = Function.param(0) <--- (Function.param(0) would contain the name of the hero you work with) 
    lerp(self.width, (Hero.POWER/Hero.POWER_MAX)*BarrePOWER_A.LargeurInitiale, 5*dt) <-- (This wouldn't work in this example. But what is important to notice is that you can replace the "HardcoreGirl" with "Hero" and thereby make it work for all of them. rather than having to duplicate code, which I guess you want to avoid. But the principal is the same."
    
    [/code:1l7ubrr1]
    
    In this case assuming the lerp worked, it would happen to the hero with the name you call the function with.
    
    Another way is to use a family and add all your heroes to the family. Which would allow you to do as show above as well. Just make sure that all shared variables are added to the family object and not the individual heroes.
    
    Again a good idea to use a unique variable such as name even if they are in a family.
    
    Both methods also allow you to use "for each FAM_heroes" if that's what you called the family or "For each Hero" if you just use one  sprite for all heroes.
    
    However using Families are in my opinion the way to go as you can better work with each individual hero.
    
    If none of what I wrote here makes sense. I suggest you read about "Functions" and "Families" in the manual. And if I misunderstood you, then ignore what I wrote
  • You can generate 4 random numbers and store them in variables then combine them and store them in a string.

    Random_IP = <Random nr 1> & "." & <Random nr 2> & "." & <Random nr 3> & "."& <Random nr 4>

    You can then use tokenat(Text, index, Seperator) if you ever have to extract the numbers again.

    Tokenat (Random_IP, 0, ".") <---- Will get you <Random nr 1> in above. So you simply increase the index number to get the rest of the numbers.