jsutton's Recent Forum Activity

  • I read it, and just can't figure out a way to do what I want.

    I have 2 variables on the tilemap CurrentX, and CurrentY. They are set using

    CX = Tilemap.PositionToTileX(Touch.X)

    CY = Tilemap.PositionToTileY(Touch.Y)

    This gives a grid location to all of the sprites that I can read in the debugger (also to use for other things).

    I would like to add

    AT START, for each tile set CX2 and CY2 based on the x,y value of each tile.

    My question is if this is possible or does it require input (touch, click, etc)

    (Kind of a check to make sure things are matching, but also to use in another array)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Never needed to use a tilemap and was trying to avoid learning.

    Would you happen to know how to set a variable for each tile by it's grid location?

    I can do it manually with On touch set var1 = Tilemap.PositionToTileX(Touch.X)/Y

    But can't figure out how to do it at the start of layout. It returns the x,y of the map itself an not each tile.

  • Are you using different fonts, sizes, or just color variations?

  • 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.

jsutton's avatar

jsutton

Member since 31 Mar, 2015

Twitter
jsutton has 1 followers

Trophy Case

  • 9-Year Club
  • Forum Contributor Made 100 posts in the forums
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies