Top 10 high scores not saving.

0 favourites
  • 1 posts
From the Asset Store
Creepy Sprite Font suitable font for your Dark/Horror/Halloween games.
  • I followed the tutorial called "Construct 2 Tutorial - Top 10 High Score" It updates properly, but it does not save the high scores from game to game, as far as I can tell the code I put in is identical but I probably missed something.

    I did change the int(timer) to score because "score" is what I want it to be, also I got it to work fine earlier but I must have changed something by mistake.

    [quote:3f3em5cq]?<?xml version="1.0" encoding="utf-8" ?>

    <c2eventsheet>

    <!--All the 'name' attributes are ignored by Construct 2 - they are there for readability only.-->

    <name>Gameover</name>

    <events>

    <variable constant="0" name="HighScore" sid="4560920227765854" static="0" type="text">0,0,0,0,0,0,0,0,0,0</variable>

    <event-block sid="6576873843025282">

    <conditions>

    <condition id="-2" name="On start of layout" sid="2289107869941966" type="System" />

    </conditions>

    <actions>

    <action id="0" name="Set text" sid="6293340639263178" type="Score">

    <param id="0" name="Text">"" & Score </param>

    </action>

    <action id="6" name="Stop" sid="8091178824832142" type="Audio">

    <param id="0" name="Tag">"intro"</param>

    </action>

    <action id="6" name="Stop" sid="3078555902818106" type="Audio">

    <param id="0" name="Tag">"starpunishergame"</param>

    </action>

    <action id="0" name="Play" sid="4651232519494572" type="Audio">

    <param id="0" name="Audio file">deathmarch</param>

    <param id="2" name="Loop">1</param>

    <param id="3" name="Volume">0</param>

    <param id="1" name="Tag (optional)">"deathmarch"</param>

    </action>

    </actions>

    </event-block>

    <event-block sid="8797411707054581">

    <conditions>

    <condition id="3" name="On touched object" sid="9516537778406053" type="Touch">

    <param id="0" name="Object">Sprite14</param>

    </condition>

    </conditions>

    <actions>

    <action id="-2" name="Go to layout" sid="4212114462736487" type="System">

    <param id="0" name="Layout">Game</param>

    </action>

    </actions>

    </event-block>

    <event-block sid="6037624765301079">

    <conditions>

    <condition id="-2" name="On start of layout" sid="3782238121964876" type="System" />

    </conditions>

    <actions />

    <sub-events>

    <event-block sid="751258782348421">

    <conditions>

    <condition id="3" name="Local key exists" sid="8606213762629875" type="WebStorage">

    <param id="0" name="Key">"Whighscore"</param>

    </condition>

    </conditions>

    <actions>

    <action id="-9" name="Set value" sid="2885793187682472" type="System">

    <param id="0" name="Variable">HighScore</param>

    <param id="1" name="Value">WebStorage.LocalValue("Whighscore")</param>

    </action>

    </actions>

    <sub-events>

    <event-block sid="7935301620920206">

    <conditions>

    <condition id="3" name="For each element" sid="2441348244537955" type="Arscore">

    <param id="0" name="Axes">2</param>

    </condition>

    </conditions>

    <actions>

    <action id="2" name="Set at X" sid="3516077020861709" type="Arscore">

    <param id="0" name="X">Arscore.CurX</param>

    <param id="1" name="Value">int(tokenat(HighScore, Arscore.CurX, ","))</param>

    </action>

    </actions>

    </event-block>

    <event-block sid="8575055489720205">

    <conditions>

    <condition id="-22" name="Else" sid="7958628043446073" type="System" />

    </conditions>

    <actions />

    <sub-events>

    <event-block sid="3104222367153982">

    <conditions>

    <condition id="3" name="For each element" sid="1030148655633583" type="Arscore">

    <param id="0" name="Axes">2</param>

    </condition>

    </conditions>

    <actions>

    <action id="2" name="Set at X" sid="828723951213684" type="Arscore">

    <param id="0" name="X">Arscore.CurX</param>

    <param id="1" name="Value">int(tokenat(HighScore, Arscore.CurX, ","))</param>

    </action>

    </actions>

    </event-block>

    </sub-events>

    </event-block>

    </sub-events>

    </event-block>

    <event-block sid="1291233219090608">

    <conditions />

    <actions>

    <action id="8" name="Sort" sid="5599641728423346" type="Arscore">

    <param id="0" name="Axis">0</param>

    </action>

    </actions>

    </event-block>

    <event-block sid="434153246148881">

    <conditions>

    <condition id="-8" name="Compare two values" sid="4689218700650281" type="System">

    <param id="0" name="First value">Score</param>

    <param id="1" name="Comparison">4</param>

    <param id="2" name="Second value">Arscore.At(0)</param>

    </condition>

    </conditions>

    <actions>

    <action id="9" name="Delete" sid="6166214121670874" type="Arscore">

    <param id="0" name="Index">0</param>

    <param id="1" name="Axis">0</param>

    </action>

    <action id="10" name="Insert" sid="2893159349809816" type="Arscore">

    <param id="0" name="Value">Score</param>

    <param id="1" name="Index">0</param>

    <param id="2" name="Axis">0</param>

    </action>

    <action id="8" name="Sort" sid="7731900927665132" type="Arscore">

    <param id="0" name="Axis">0</param>

    </action>

    </actions>

    </event-block>

    <variable constant="0" name="N" sid="3384885840732017" static="0" type="number">9</variable>

    <event-block sid="2465961104680723">

    <conditions>

    <condition id="-11" name="For Each" sid="7660304513381681" type="System">

    <param id="0" name="Object">txtscore</param>

    </condition>

    </conditions>

    <actions>

    <action id="0" name="Set text" sid="5070868810117637" type="txtscore">

    <param id="0" name="Text">Arscore.At(N)</param>

    </action>

    <action id="-11" name="Subtract from" sid="858588247653677" type="System">

    <param id="0" name="Variable">N</param>

    <param id="1" name="Value">1</param>

    </action>

    </actions>

    </event-block>

    <event-block sid="5761020993719">

    <conditions />

    <actions>

    <action id="0" name="Set local value" sid="6725284393695319" type="WebStorage">

    <param id="0" name="Key">"whighscore"</param>

    <param id="1" name="Value">Arscore.At(0) & "," & Arscore.At(1) & "," &Arscore.At(2) & "," &Arscore.At(3) & "," &Arscore.At(4) & "," &Arscore.At(5) & "," &Arscore.At(6) & "," &Arscore.At(7) & "," &Arscore.At(8) & "," &Arscore.At(9) </param>

    </action>

    </actions>

    </event-block>

    </sub-events>

    </event-block>

    </events>

    </c2eventsheet>

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)