Savvy001's Forum Posts

  • Woops

    Here is the good one.

    Capx

  • Hi sqiddster

    I was reading through the comments and suddenly a simple endless world generation engine popped into my thoughts.

    You asked for something that was non repeatable, and as far as i understood you did not meant to save the world layout.

    So here is a little demo i just fixed.

    This one is top down, but u could simply apply this same technique if u want to create a platform game.

    Demo

    And here is the capx.

    Capx

    Let me know i this would help.

    Kind Regards.

    Savvy001

  • Il be checking in to that tomorow, and i will report back to u!

    Thanx for the help. <img src="smileys/smiley32.gif" border="0" align="middle" />

  • droptank21

    Hi droptank21.

    I have tried to get it to work but i am unsuccesfull.

    I understand your capx and php codes are correct, and that my knowledge is simply missing on how to integrate this onto the server.

    I have tried:

    Creating a database. (succesfull)

    Adding the database.sql to the phpmyadmin "sql" section (succesfull)

    Modding the php files with my database login data. (succesfull)

    Uploading the php files to my server. (public_html/wwxmmo)

    Uploading the capx to my server. (public_html/Login)

    And the result is that i get a register failure and a login failure.

    Do u have any idea what i am doing wrong?

    Kind regards.

    Savvy001

  • Hey Hamood

    Look at it like this.

    The webstorage has 2 different methods of saving your data in the browser.

    1 = Session

    This one only exists as long as the player has the tab opened in the browser.

    Closing the browser = finito, adios amigo, no more save game.

    2 = Local

    This one saves as a local cookie.

    Meaning that the next time the browser is started again "and" the player starts the game, he/she can collect the data back into the game from that local cookie.

    So for savegames u need local storage.

    Know however that the standard MB limit of local webstorage cookies is at 5 MB.

    This 5 MB limit is browser dependant, and the browser can ask the player if he/she wants to exceed this limit to a larger amount.

    Now, to understand how to save "any" data u simply need to understand the code that Astrosus allready gave to u.

    Once u understand his "2 event" code, the last quest is to know what to use for building a propper save game.

    Thats where variables come in.

    You can create "Global" variables in the event editor, by right clicking the mouse and selecting add global variable.

    See these Global Variables as your data house where u collect the progress of the game.

    Besides the Global Variables u can also create variables straight into the sprites themselves.

    These are called "instance variables".

    To do that u select a sprite, and on the left side of the screen above the "add" behaviour option is the add instance variable option.

    Now, im only going to explain by using global variables, but the trick works for any variable.

    Example. (all done in the event editor)

    First add a Global Variable named: Hits

    After that, create an event where the player hits the enemy with a projectile.

    Event: Projectile colides with Enemy = Add 1 to Global Variable "Hit"

    This is the basics.

    Then using the code Astrosus gave u, u can save this "Hit" Variable to the local webstorage.

    Create Event.

    Event: Mouse left click on save button = webstorage.setlocalvalue("hit" & Hit)

    Now u look at ("hit" & Hit) and probably go... huh?

    The first word hit between the quotation marks is the name of the saved data. ("hit")

    The second (& Hit) is the Global Variable you want to put as a value under the name "hit".

    So if u have hit the enemy 2 times the data "within" the local webstorage would be ("hit" = 2).

    But we save it as webstorage.setlocalvalue("hit" & Hit)

    So now u hopefully understand that the, (& Hit) points tot the Global Variable named Hit.

    Retrieving the saved data is as simple as setting a event on start.

    Or choose a load button.

    Event: When mouse click on Load Button = Set Global Variable "Hit" to webstorage.localvalue("hit")

    Then Construct2 loads the saved data that is saved under the name "hit" into the Gloabal Variable named Hit.

    Repeat this for all things u want to be saved and your done.

    So if u want levels to be saved, then Global Variables are the way for u, as they reach across the boundaries of levels.

    Meaning that a Gloabal Variable set to 2, = 2 for as long as the game runs.

    U can tell the game to save each level progress as, Add 1 to Global Variable "Level"

    Then putting it into the local webstorage.

    Retrieving it later when load button is pressed.

    And then have the Layout number set to the Global variable.

    Boom, there u have it.

    Hope this helps and that i spoke clearly.

    Kind Regards.

    Savvy001

  • rexrainbow

    Wow thats fast!

    Thank u Rex, this is the feature that makes my universe app complete!

    The scope of things we can do with this is BIG.

    When im at home tonight im going to code the **** out of my pc ;-)

    U sir, are a true gentelmen!

  • Any news anno dec 2012 on textbox and comboboxlistbox compatability with cocoonjs.

    My app depends on those 2.

    And i would really like to use cocoonjs.

    Kinnd Regards.

    Savvy

  • Thanx septeven

    The loose focus option was exactly what i was looking for.

    It makes my app more user friendly!

  • Joannesalfa

    U can using the Unixtimestamp.

    U need to save the unixtimestamp as webstorage-localvalue.

    Then compare that saved unixtimestamp with the current unixtimestamp.

    U can do that by setting a "global variable" to the current unixtimestamp while substracting the webstorage-saved unixtimestamp.

    Every tick: set global variable to date.getunixtimestamp-webstorage.localvalue("save unixtimestamp")

    The key is to calculate the data "from" that global variable.

    So u can calculate the weeks/days/hours/minutes/seconds.

    The global variable is set as the "difference" between past time and present time.

    If i am correct u can calculate the days by dividing that "difference" by 864.

    That leaves u with a big number which u would need to set to "floor" or "int" to get only the number before the (.)

    Maybe not everything i type here is spot on because im not at my pc right now, but u get the general idea.

  • rexrainbow

    U just made my day!

    Please let me know when the time comes <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Thanx for the answers!

    The problem with making it a bigger starry background is that my app uses inf space synced to time.

    So then the starry background would also need a inf size.

    That on its own is not preferable.

    Bounding the stars would be best.

    However, i came across a explanation of Yann.

    He set up a code that enables a large amount of objects to stay bounded to a centered sprite using a offset logic when unbounded scrolling is enabled.

    Im going to give that try and see how it works.

    Thanx again!!

    Kind Regards.

    Savvy001

  • Thanx Yann but i think that dt would not be enough to set it in sync with the system time.

    I could be wrong about that, so please correct me if so, then i could learn.

    I kept trying the past few hours and i finaly figured it out.

    Check the screen if u like.

    <img src="http://www.conceptsarea.com/Scirra/RealtimeClock.png" border="0" />

    Thanx for the help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have a question

    I need to rotate a sprite 360 degr synced to the system time.

    But i want to move it according to milliseconds.

    So the sprite will move smoothly and takes 24 hours to rotate "Realtime".

    I tried some things with the system date and time plugin, but i have not been able to figure it out.

    Allready searched through the forum, but cant find anything this specific.

    Any pointer?

    Would be great.

    Kind Regards.

    Savvy001

  • Hi All!

    I am creating a twinkly star background.

    Top Layer is set to 100,100 Paralax. (solar system)

    Sub Layer is set to 10,10 Paralax.   (Stars)

    Bottom layer is set to 5,5 paralax.   (Deepspace stars)

    The stars are on the Sub and Bottom layer.

    I have the Layout set to unbounded scrolling because i need to scroll the "solar system" freely unbounded.

    Here is the problem.

    I want the stars to move slightly to the left/right/up/down.

    Thats where the paralax comes in.

    The thing is that because of the unbounded scrolling is set for layout and not per layer, the stars eventualy move completely of screen.

    Without unbounded scrolling, i get the effect i need.

    But then i loose my scrolling "freedom" of the top layer.

    So the ideal way for me would be.

    Top Layer = Unbounded Scrolling with Paralax set to 100,100.

    Sub Layer = Bounded Scrolling with Paralax set to 10,10.

    Bottom Layer = Bounded Scrolling with Paralax set to 5,5.

    (I think the functionality to do this has yet to be build in to construct2 Ashley ?)

    So for now i'l just event the stars manualy to move at a variable rate until a specific set max.

    If however i am looking in the wrong direction here then please fill me in. <img src="smileys/smiley31.gif" border="0" align="middle" />

    Kind Regards.

    Savvy001

  • Hi rexrainbow

    I am currently looking for a way to convert the date and time into a unix timestamp, and vice versa.

    Meaning that the user of my app could fill in a date and time, so my app knows which timestamp it needs to set.

    This way i could save 1 "future" set timestamp, and a present set timestamp.

    THen compare them every thick, and move set actions to the difference between the 2 stamps.

    Can u build in a expression for this which converts the date & time, or am i missing something that is already build in?

    Kind regards.

    Savvy001