Guizmus's Forum Posts

  • You should take a look at their documentation on the C2 API.

    Here is the part on leaderboards :

    [quote:2az2vcv0]In Construct 2

    Actions

    Post Leaderboard Score

    Name is optional, if specified, it will show up next to the score. If not specified, Clay.io will ask the player for his or her name

    Score should be set to whichever variable (expression) you have the score stored to

    Leaderboard ID is what you were given after creating the leaderboard on Clay.io

    Post Encrypted Leaderboard Score

    This requires a backend for your game, but you can have more secure high scores by sending an encoded JWT (JSON Web Token) that specifies the score. See http://clay.io/docs/encryption for further details

    Show Leaderboard

    Leaderboard ID is what you were given after creating the leaderboard on Clay.io

    Time Frame is how far back in time you want to grab scores from

    High Score can be set to individual (a single score per time they post a score), cumulative (each time they post a score it is added to their total score), or best (only use the best score from each player)

    Sort is for the order of scores. Descending is highest to lowest, ascending is lowest to highest

    Scores From can be All (scores from everyone who has played the game), Personal (just the current player's scores) or Friends (just the player's Clay.io and Facebook friends' scores)

    Fetch Leaderboard

    If you would like a more customized-looking score table, you can fetch the list of high scores and loop through them using a System -> For loop from 0 to Clayio.LeaderboardScoreCount. The options to fill in are identical to above

    Hide Leaderboard

    The leaderboard already has a close button and closing it is bound to the "esc" key, but you can also close it with this action

    Conditions

    Leaderboard Score Posted

    This is called when a score is successfully posted to Clay.io. A good use for this condition is to display the leaderboard immediately after the score is posted.

    Leaderboard Scores Fetched

    This is called using the event "Fetch Leaderboard Scores" when they are successfully fetched

    Expressions

    LeaderboardScoreCount

    The number of scores fetched using "Fetch Leaderboard Scores"

    LeaderboardName

    Use this in conjunction with a System -> For loop from 0 to Clayio.LeaderboardScoreCount to fetch high score names - it will look like this: Clayio.LeaderboardName(loopindex)

    LeaderboardScore

    Use this in conjunction with a System -> For loop from 0 to Clayio.LeaderboardScoreCount to fetch high score numeric scores - it will look like this: Clayio.LeaderboardScore(loopindex)

    LeaderboardScoreMe

    Use this in conjunction with a System -> For loop from 0 to Clayio.LeaderboardScoreCount to fetch high scores. Returns 1 if the current score was posted by the current player, 0 otherwise - it will look like this: Clayio.LeaderboardScoreMe(loopindex)

    LeaderboardRank

    Either the rank the player just achieved - or their highest rank if their score wasn't just posted (when using "Fetch Leaderboard Scores")

    LeaderboardRankName

    The name of the player playing (when using "Fetch Leaderboard Scores")

    LeaderboardRankScore

    The score the player just achieved - or their highest rank if their score wasn't just posted (when using "Fetch Leaderboard Scores")

  • Well, first of all, event with an html element handled in C2, you may have problem, as the like counter and button is an iframe, and is handled by facebook. When you add such a box in a webpage, you add the element, and facebook does the rest : check for connection from user (to display if he already likes), collect the page's meta if it wasn't in cache, ... And the clicks are also handled by facebook. So it doesn't seem fitting to put the like button INSIDE C2. Why do you want them inside ? What do you want to do with them ? Even if you successfully have the iframe element created inside C2, you won't have the onclicks, so it seems like a

    Subscribe to Construct videos now

    .

  • There are ways to do this.

    First, you can add a display:none on your <canvas> in the php/html directly. This way it won't be displayed at first.

    Then, in C2, add an event "On start of layout" with the action "ExecJS" from the Browser object. This way, you can call a function that you declared on the page.

    Be careful though, read the manual concerning ExecJS, as there are security issues. If possible, don't use it at all.

  • The tooltip is an HTML property that you won't be able to change, not its behavior at least.

    If this behavior doesn't fit you, you should then try to replicate it. Each textBox could be put in a container with a text/spritefont object, so when one is created/destroyed, so is the other. The text would be used as a tooltip then, you just have to position it. You can also add a 9patch in the container to make a background for this tooltip. Then, all you have to add is display/hide the text/BG depending if the textBox is focused or not.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I made a tutorial explaining and building a dialog system. The example that goes with it is more or less a simple text adventure with multiple choices, like you described. Here, take a look.

    But like Teacherpeter said, you are looking for something quite basic, so this solution might be too big for your need. If so, you should start by doing more tutorials maybe.

  • I tried to use C2 programs, inserted using userscripts, inside a page I didn't host, to add functionality to a browser game. I had to trade some data between C2 and the webpage. I used a "notification system" to dialog between the two, meaning :

    • each time the JS needed to send data to C2, it would store a request (see below) in an array, using a function "sendNotification".
    • a request was a string with a C2 function name (function meaning the Function plugin), and arguments, separated with a "__".
    • each tick, C2 would execute a code "getNotification()" with execJS, and would be returned the string of the first waiting request, with a "this.lastRequest" evaluation like R0j0 explained. The request was then analysed and the correct function was called with the correct arguments in C2, handling the request (depending on type of request, like update life, ...)
    • the other way was quite simple, as you can just execJS the functions you want in the webpage from C2.

    This was for intensive exchanges, but the method can be used in other ways, including simple ones. (2 C2 games running on the same page, chatting with each other ?)

  • If I was wrong, go over the Bug forum, providing one of those .zip not working.

    Don't need to write like that if you need help, it won't help, And it can be taken to be rude...

  • QuincyDK

    Hey, sorry I wasn't of more help either to your problem in the other post. What you just said made me ask myself : are those static data ? If so, the problem isn't the same. Executing code through execJS won't be a problem as it will only be for development. Once you've got the static data loaded in you array(s), you can use the "download" action to get there content as a C2 formated JSON file, that you will then be able to use in replacement of the execJS, for the real game.

  • In the last project you shared, the variable is an instance variable on the objects "light", and its name is ... "color".

    As for other solutions, no I don't. I ran into the same exact problem (top down, stealth game), and used another light system, a lot less attractive (no light around corners possible at all, light was going only on X and Y axis...). It won't be your solution.

  • Wossi

    For changing the color, just look at the event 2 action. The color is a local variable on each Light object, you can change it there.

    As for the background, I can't help you, I don't know.

    Just so you know, on a classic office computer (no fancy graphic card, 2GB RAM), this project got my firefox and chrome to crash. Canvas takes a lot of resources on top of C2...

  • Hey,

    "Object reference not set to an instance of an object"

    This error means that the game crashed when you tried to handle an object that wasn't in the layout.

    Said differently, you are manipulating an object (sprite or any other object) in a layout, but didn't have any instance of this object in the layout at the start.

    It is important to have at least 1 instance of any object you need at the start of the layout. If there are enemies to spawn, but you don't want them at the start of the game, then put at least 1, and destroy it at the start of the layout. But if you try to "spawn" an enemy without one present at the start, it will crash.

  • You do not have permission to view this post

  • cesarzevil

    What did you try to solve this problem ?

    Did you understand where this comes from ? Look at your events. As you describe it, "When click on red ball and drag over the yellow ball, both balls are thrown". This means that the "trowing" event is also triggered when the mouse goes on top of the yellow ball.

    So if you want the mouse to trigger only the first ball it touches during clicking, you need not to activate the "ivPickedBall" of each ball every tick. Instead, you need to activate only the first ball touched, and then set this boolean to false on touch end.

  • nimos100 Still great piece of advice for any new developer. This isn't restricted to C2, it's great coding practice and will save a lot of time to anyone going for anything big. And for the experts, it's also a good reminder !

  • Tom

    Lots of testing on the attachments and some details that could even better this system :

    • it is possible to see the list of attachments we sent from the control panel (very nice), and so to use the same attachment using its URL in other posts. Doing so, could the post parsing function detect it as an attachment and not a standard URL ?
    • in the post about URL posting limitations, it would be nice for new users to see that the solution instead of URLs is the attachment, at least to mention it in the post to promote the use of this tool
    • would an "update attachment" function be useful ? Replacing the old file with a new one, reduction server-side space used in those cases ?