jangsy5's Recent Forum Activity

  • aw dang. Just when I found the money to buy win 7 I find out win 8 is going to come out...

  • I'm glad you handled well. I just learnt something :D <img src="smileys/smiley31.gif" border="0" align="middle" />

  • Already implemented. Thanks for the feed back too.

  • Since there actually isn't an object that handles a list of highscore I devised a method to do so in my game. Please correct or simplify it if you can do so. Some of it is in code, other bits are just descriptions. I'm not a wiz at coding so if this is wrong please point that out too.

    Assumptions:

    hsnumb[1...11] = int.

    hsname[1...11] = str.

    score = int.

    name = str.

    hsnumb[z] corresponds to hsname[z] (score and name)

    there are 10 places in the highscore

    Code:

    /// for loop

    ///

    for(z=10;z>0;z--;){

    if(hsnumb[z]<score){

    hsnumb[z+1] = hsnumb[z];

    hsname[z+1] = hsname[z];

    hsnumb[z] = score;

    hsname[z] = name;

    }

    else

    break;

    }

    /// end of loop

    ///

    Description:

    So here's what I did. I initiated a for loop. It starts at 10 and finishes at 1, I hope. If the variable i is not greater than 0 it ends the loop.

    If the statement is true then it checks if hsnumb[z] is less than 'score'. If so then hsnumb[z] will be placed 1 below that of itself which would be hsnumb[z+1]. hsname[z] will also be substituted into hsnume[z+1].

    Then that same array is substituted by the new score and new name, that is, hsnumb[z] = score, hsname[z] = name.

    If the 'If statement' is not true then the whole loop ended since there is no need for it.

    Essentially this code systematically goes through the highscore list from 10 to 1 to see if the new score is greater than any one of them. It starts from the bottom since it seemed to be logical and less convoluted from starting from 1. It checks to see if 10th score is less than the new score. If it is true then 10th score is put into a non existing 'garbage' (11th place) which is not displayed nor saved, it is just there as a place holder in prevention of a logical error. After that the 10th place is replaced by the new score (+name).

    This code then loops to check the 9th place to see if the new score is greater. If so then substitutions similar to the 10th place mentioned above occurs. 9th score is subbed into 10th score (which was new score) and the new score now subbed into 9th.

    The whole process continually repeats until it reaches 1st place or the new score is less than the place it's currently being compared with.

    I assume this works in a C++ coded game but I don't know if it's fully possible in the event sheet of CC.

    If there's already a tutorial about this without a cap file then I shall initiate a face palm procedure. If you did not understand the code then learn Arrays and For loop.

    Please tell me if this is right because I don't want to think about this for any longer. I'm moving onto my highscore save methods.

  • Oh Jobs why must you exploit something that once protected your frail company. One day you will have an epiphany just like Bill and resign and give half your fortune to charity.

  • > If there's a simpler way then please do tell me.If not would using pv more manageable than the other ways? Or am I understanding this all wrong and infact hash tables and arrays are nothing like pv (I know arrays are different).I would probably use global variables for this. Although, I'm not sure if you are aware of, but there's an expression that returns the number of instances of an object (Get number of objects), so you don't need to create your own counter depending on the case. You just need to use a System "Compare" condition and put it like "Sprite.Count < SpriteMaxCount".

    Ah I was looking for that in the editor but had no success. Thank you people for enlightening me on this area of programming. I just got better at it.

  • Hm... interesting. I thank you for your time. I shall try and do both to see which one fits my logic the best.

  • Hum... so could you tell me how>

    For the sake of discussion I want to create the character 'pac man'. I create him as sprite object.

    In the main layout(show when the app is launched) I want pac man to appear at a random position when I press the enter key and not when the layout has just loaded.

    In fact the when the app is open it's just a black screen, so when I press enter a pac man spawns, I press enter again another pac man spawns, etc etc etc. So tell me, how would I do that?

    How do I add a sprite object into a layout without it actually being placed 'visually' in the layout itself (while using CC, since I found out you have to actually place it onto a layout to use it), so I can create an instance of it to appear on the layout while running the app.

    I'm sorry if you guys couldn't understand me... or is it me who don't understand you? @

  • Try Construct 3

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

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

    I want to keep track of a sprite object (dots,balls, you get what I mean).

    More of it (instances I assume) spawns with time.

    I want to create a set amount that will increase over time too.

    Hence I thought of 2 variables to keep track.

    One keeps track of how many of that object exist and the maximum amount of that object should exist.

    So I thought I could attack 2 private variables to an object such as a text object.

    So I created

    DotCount :: variable that keeps track of actual amount

    DotCountMax :: variable that is the number of maximum amount that the sprite object should exist

    That's just one object. There's actually 3 more so...

    DotCount

    DotCountMax

    YDotCount

    YDotCountMax

    GDotCount

    GDotCountMax

    Each of these I use to keep in check how many of those objects exist. How I do that is when an event is executed the object/instance spawns in the layout and variable DotCount increases by 1 to indicate there's 1 more of that object in existence.Then DotCount is compared to DotCountMax to see if DotCount < DotCountMax, if so then the cycle repeats and instance is created again.

    If there's a simpler way then please do tell me.If not would using pv more manageable than the other ways? Or am I understanding this all wrong and infact hash tables and arrays are nothing like pv (I know arrays are different).

  • I'm sorry if I'm asking a lot of questions but I'm trying to learn this engine as quick as possible before my midterm break finishes.

    Back to topic I'd like to ask; when I'm trying to store integers like the amount of a certain object is created and the maximum amount of that object should be created should I use Hash table or variable, or array? I know this is kind of low level stuff I should find out on the net but reading those stuff is too technical and I can't find what I want to know.

    I guess I could use array but I have no idea how real arrays work or to be specific store the information (damn game maker I curse you for making it too simple).

    Also would the choice still apply if I use whole lot more information, such as the value mentioned before but to keep track of multiple objects?

  • Something confuses me a lot. I don't understand why I need to place all sprite objects within the layout. What I'm saying is that I want the sprite "dot" to be just in the objects list and not actually be placed into the layout yet, instead I want it to be created when an event is activated.

    Is it possible to not place it in the layout or do I have to hide it and somehow inactivate it?

  • Oh ic thanks a lot R0J0hound I didn't know such a software existed.

jangsy5's avatar

jangsy5

Member since 17 Aug, 2011

None one is following jangsy5 yet!

Trophy Case

  • 13-Year Club
  • Email Verified

Progress

14/44
How to earn trophies