jsutton's Forum Posts

  • Forgot 1, could use a spreadsheet and create a json for spawn points. Load that in an array and then run 1 loop.

  • I need to make a map using sprites that are 60px x 40px (3:2 ratio), 10k sprites in total.

    For a long list of reasons, I'm avoiding a tilemap.

    I could do nested loops (but that would be 56 deep and hard to read on c3 console), I could hard code it, use an array, just setup the sprites manually.

    At present I'm thinking about using a mile long function and variables for on create points.

    Not a single way seems very good for 10k sprites.

    Any ideas?

  • That's been a topic for a while. Last I heard iphone resize could be turned off in config, but for Android (it's

    an android issue) it requires a homemade keyboard. I'm commenting to be on this thread, curious if anything has changed.

  • Try something like this:

  • (Curious if anyone has done something similar or has an idea to simplify this)

    I'm looking to display a large (9,961 map square sprites) or so, scrollable map that shows the position of user locations (icons with x,y coordinates and user information). The graphics don't have to be awesome, but the info will need to be updated when changed. The map can change but is usually static.

    Things I've done:

    1. Pin map square sprites (60x40) to a background sprite (3500x3500). The background has the drag/drop behavior. The Pin behavior calls were eating up 34% of memory, so changed pin on start to on touch start/end, pin/unpin. Pin must be an every tick behavior and changing it to touch dropped cpu behavior calls to 5% of memory. (Amazingly, this doesn't seem to be causing any display issues when doing preview on mobile and is very smooth scrolling.)

    2. Changed the layer scale to 3 (graphics are meh, but scrolls smoothly).

    3 Used save as json (array) for the locations of user sprites (about 300kb max size) and have a variable used to check the server for changes. (Everyone uses the same .json map file, but there is a cell in a mysql database call changed. If changed = 1, then users update their maps else use the previously downloaded map.

    Anyway, just looking for ideas. Thanks in advance!

    Tagged:

  • I'm going to assume this is only using local time on the users device (otherwise you'll need a server for your unix timestamp, which stops the user from cheating by adjusting their clock).

    Date.now returns the a unix timestamp (in Milliseconds) based on the users device time

    Floor(date.now/1000) returns the unix timestamp in seconds.

    Unix time is a way of representing a timestamp by representing the time as the number of seconds since January 1st, 1970 at 00:00:00 UTC. One of the primary benefits of using Unix time is that it can be represented as an integer making it easier to parse and use across different systems.

    For a simple count down:

    When your timer starts set a variable to current timestamp Floor(date.now/1000) plus the number of seconds you want to countdown. (for 1 minute it would be unix timestamp plus 60)

    Then every second (or add 1, 1dt, etc.) compare the current time vs the timestamp and display it. (using the above formatting for d/h/m/s)

  • The easiest way I know is using distance as an instance variable on your character sprite. Something along the line of:

    Every tick

    Pick the tile by compare, tile.ID = whatever number it is

    Action

    set variable, distance(sprite.x,sprite.y,tile.x,tile.y)

    Then use that variable to do what you want.

    If the tile needs to change over time, you could use a variable for the tile ID, etc.

  • An example:

    Building_Upgrading&": "&zeropad(floor(UTR/84600),2)&"d "&zeropad(floor(UTR/60/60%60),2)&"h "&zeropad(floor(UTR/60%60),2)&"m "&zeropad(floor(UTR%60),2)&"s"

    UTR is my time variable (Global)

    With zeropad 1d 05h 01m 01s

    Without 1d 5h 1m 1s

  • This was for "@\S+" and "#\S+" while typing, but could be anything.

    Was the tightest bit of code I could come up with and thought I'd share.

    (see a lot of regex questions regarding this topic and there isn't much out there that really explains it well. The actual expression would depend on your need, likewise the criteria for a match and replace. Hopefully it helps someone else.)

    3 items: array, textinput (set to invisible), and a textarea.

  • I've done some research on that, and frankly I'm lost as to how to implement DOM parse. I see "simple DOM" for PHP but seriously above my paygrade lol.

    I managed to get the following down from websites that have a widget added.

    Which works 98% but... occasionally has issues loading the image (I put a default image in place since some pages don't have an associated image or it fails to load).

    If you wouldn't mind expounding on the DOM, I'd appreciate the insight.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The app I'm using was created in c3, which can do anything really. I parse everything via c3...just easier to manipulate inside. I have considered using php to get what I need but that's kinda out of my pay grade.

    I'm using the meta tags, and not raw data...which should be stable (as in not many changes since that would break all websites using the info.)

  • Curious if any of yall have experience with this?

    I'm using PHP to pull html data from a webpage, but have to manipulate the data pretty heavily to get what I want off the page. (regexmatchat and replace multiple times, etc)

    Any tips or ideas for simplification?

  • Would anyone happen to know how to play an embed youtube video (with sandbox enabled) in an iframe without violating this warning from the manual?

    If I enable the allow script and origin the video plays and I can adjust it's attributes, but can't seem to find any other combo that works (disabling the sandbox and using the basic allow works fine).

    I don't use any scripts or html content, just play embeded videos...so, I'm not sure that security really even matters?

    What I am trying to achieve is having an iframe pinned to a scrollbar and when the iframe hits the top or bottom of the layout it doesn't change. Presently the iframe content does not change ie, video itself does not shrink as it moves off screen (fullscreen), but the text and play buttons move and cause a "jitter" which is really annoying. All I'm really trying to solve is removing that jitter at top and bottom of layout*

  • Can you pick nearest to sprite xy based on whatever criteria you set?