randomly's Forum Posts

  • Problem Description

    Hi everyone.

    When requesting the location with the native Geolocation plugin under an NW.js export or preview, the event "On error" triggers, the error message is:

    "Network location provider at 'https //www.googleapis.com/' returned error code 400"

    This seems to be related to NW.js only.

    I googled the error message, some results said it's related to Google Chrome (would make sense, NW.js uses Chromium), but when previewing in Chrome (not NW.js), everything works.

    I'm no programmer, but I would assume, this problem is related to NW.js, not C2.

    But maybe there's a workaround to get it to work (apart from not using NW.js, obviously) without having to rely on an NW.js update.

    Capx

    You can use the default Geolocation template.

    Description of Capx

    Testing the Geolocation plugin to its full content.

    Steps to Reproduce Bug

    • Use either action Request location or Track location
    • When previewing in or running the exported NW.js, On error will trigger
    • The expression Geolocation.ErrorMessage will be the above-mentioned message

    Observed Result

    See steps above.

    Expected Result

    The event On location update should trigger and the expressions Geolocation.Longitude and Geolocation.Latitude should return the approximate location.

    Affected Browsers

    • Chrome: (NO)
    • FireFox: (NO)
    • Internet Explorer: (NO)
    • NW.js: (YES)

    Operating System and Service Pack

    Windows 7 64bit, SP1

    Construct 2 Version ID

    Construct 2 r244, most current NW.js (v0.22.0 (Chromium 58)), released 20th of April 2017.

  • I won't even bother asking why you would want to create this kind of game, but I have taken the time to create an example .capx for you.

    You can download it here.

    Two sidenotes:

    • It is quite complicated, don't hesitate to ask if you should have questions
    • I am convinced that the way I did it is not the perfect way of doing it in C2, but I couldn't think of any other way. If anyone has a better idea, please post it, I'm interested.
  • Hi,

    you're probably wondering why your post doesn't get any responses.

    I think the reason for that is that your question is very specific, while at the same time, not explaining what you are talking about.

    • What App ID?
    • Where is that App ID needed?

    I'm guessing you are talking about the ID property in the About tab in the Project properties.

    Have a look at the Construct 2 Manual, it usually helps you with C2-native properties.

    Extracted from there:

    [quote:16ib8ztl]ID

    An ID uniquely identifying your application. This should be in reverse domain format, such as com.mycompany.mygame. Some exporters use this as the ID for your exported app, so try to ensure it will be unique.

    This should answer your question.

  • You might wanna have a look at this thread and ask the author to reupload the .capx, looks like that's what you need.

    (Also, in the future, have a look at this post, it usually answers your normal questions.)

    For a simple and short example, I have created an example .capx for you.

    This will suffice for your situation 1 and should give you help starting your project.

    If you need more help, don't hesitate to post a reply.

  • Assuming, you are using the Platform behavior for the Player and the Solid behavior for the platform(s), you can use the Solid action Solid: Set enabled to disable the collision between the Player and the platform.

    As a side effect, this will cause the player to fall through the platform.

    Since I'm not completely sure whether your intention is to completely eliminate the collision or to just make the player not move along with the platform, you can use this workaround to make the player not stick to the platform, but also not fall through it:

    When you disable the platform's solid state, also set the Player's Platformer gravity and speed to 0.

    This will make him keep his position.

    Remember to switch the gravity and solid state back on when needed.

  • I'm pretty sure you can remove the Trigger once condition and move the Sprite conditions under the On touched event.

    No criticism, just simplifying.

  • Well, what I need to do is to display a sprite on top of the map when clicking a marker on the map.

    I guess I'll just have to move the map to the side when clicking the marker and displaying the Sprite there...

  • Try Construct 3

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

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

    Just noticed that the map obscures any sprites that are in the same area, even if their Z-order is above the map.

    (See Example .capx)

    Is there any way of displaying any sprites above the map?

  • If I understand you correctly, what you need is a way to spawn objects randomly spread on a circle?

    If so, this is what I would do:

    • Set a number variable to random(360) to get a random angle
    • Now, to the more complicated part: Getting the coordinates of the point on the circle using the angle we created before
    • Get the X coordinate with this calculation: [X coordinate of circle center] + cos(angle) * [circleRadius]
    • Get the Y coordinate with this calculation: [Y coordinate of circle center] - sin(angle) * [circleRadius]

    This should get you going.

    Here is an example .capx, in case you are stuck.

  • Looks pretty good already!

    The problem that you're encountering are collision polygons.

    Since your game is highly dependent on collisions, it's important that the collision polygon of your player fits exactly between two obstacle blocks and that the shape is the same.

    To achieve this, you'll have to look at the size of your player and your obstacles.

    Example:

    If an obstacle is 50 x 50 pixels, your player collision polygon must not be bigger than 48 x 48 pixels.

    (If it was 50 x 50 or 49 x 49, it would not fit between two obstacles)

    And you will also have to make sure that both the obstacle and player collision polygon's dimensions are 1:1 (=quadratic).

    Here is a .capx demonstrating what I mentioned. Note how the player is 48x48 and the tilemap obstacles 50x50.

    Hope this helps.

  • Just in case anybody wondered: yes, the code worked, I'm 20$ richer now.

    And I have no idea why did this giveaway, there aren't even ads in his game...

    I guess he's just a very generous and kind person!

    Thank you again !

  • If it is only object properties and not e.g. behavior-related values, you can simply export the current object's state via the object expression [objectname].AsJSON.

    You can save this with LocalStorage, Browser Invoke Download or NW.js filesystem.

  • While creating the above .capx, I ran into some issues that might be simplified by changing/updating the Listview plugin.

    Some suggestions:

    • Add a For each row condition plus a CurRow expression, returning the current row in the loop. If you got the time/motivation, you might wanna add a For each cell condition as well plus a CurCellX and CurCellY expression, returning the current row and cell index of the loop
    • Actually, this is a bug. When clicking on a row, the selectedRowIndex expression changes and the SelectedRowColor is applied, as intended. But, when you click a button outside the Listview, the background color resets back to the default color (as intended) while the selectedRowIndex expression stays the same as before. I would suggest to change the selectedRowIndex to -1 when the Listview is unfocused, so you are able to see when the user clicks outside the Listview. Alternatively, you could add a "On focus lost" event
    • I also noticed that when changing the selected row via the Select row at index action, the event On selection changed doesn't trigger. I think this should be the case
    • Last, but most importantly: A Change content at action would be freaking awesome. I would say that action should get the index of the row where you want to change the content and a content as parameters. With the current plugin, you have to remove a row and add a new one if you want to change the content of a row, which is a very tedious process. Adding the above-mentioned action would simplify this process a lot.

    That's all. (Hope it's not too much)

    Thanks for your awesome plugins!

  • The lines that were added disappear when I change layout

    Setting the Listview to Global should fix that, but not saving it across closing and opening the application, if that's what you mean.

    Here is a capx to demonstrate how to export the Listview content to LocalStorage (where LocalStorage can be easily replaced by NW.js filesystem), fully commented.

  • Noncentz705

    just in case you didn't notice the previous reply, here again: The download link is offline, you need to switch to a different filehoster, since Dropbox deprecated the "public" folder.