R0J0hound's Recent Forum Activity

  • I think it's probably easier to just make another utility capx to make the arrays and output the the ASJSON's. As it is now it's only purpose is to give a text representation of the array. It correctly mirrors how C2 stores the array internally, and I think it is unlikely that it will get changed as it would break any capx that uses "load from JSON"

  • There is the Sprite.Physics.Mass expression which is equal to density * area. Why not use that?

  • You could add "while" conditions to the top of each of the events that compare x and y, that would allow for motion beyond a screen at a time without flickering. I should also point out that the player should be moved in events above the scrolling events.

  • It's pretty simple, just add the distance the player has moved every tick to a variable, then check when the variable is greater than or equal to the certain distance.

    To measure the distance the player has moved you need to save the player's position to some variables. Give your player sprite 3 instance variables and call them "dist", "oldx" and "oldy". Then every tick do these three things:

    1. add distance(self.x, self.y, self.oldx, self.oldy) to dist

    2. set oldx to self.x

    3. set oldy to self.y

    You will probably want to set oldx and oldy at the start of layout to the players position, otherwise the distance from (0,0) to the player will be used.

  • You could try this plugin:

    http://www.scirra.com/forum/plugin-nickname-behavior-nickname_topic57943.html

    It allows for "create by name".

  • The second way you mentioned is the way to do it, you can only replace one string at a time.

  • There is no best way, all the options you cited can be used (even the csv plugin).

    For initial data, like your data strings I would opt for using external file, added to the files folder of your project, and loaded with the csv plugin into an array which works good as a list.

    Then after changing the array you could save the Array.AsJSON to the webstorage object, and just make the game load from the webstorage if it exists otherwise load from the csv file.

    If you want the database to be accessible by more than one computer then you would need a way to modify a file in dropbox or something, but that's beyond the scope of C2 and you would need to use a php script or something.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When you create a family object at runtime it already randomly creates one object type from the family. If you want to create a specific object type in a family then just create that object type.

  • Here's an observation: Every time you destroy a tile another one needs to be created at the other end of the screen. You could store the array positions of each tile in the created tile's private variables, that would help in changing the tile. You could then do a loop to check to see if the tiles around the border of the screen exist, if they don't then create the object.

    Here is a different approach that recycles the tiles by moving them to the other side of the screen as they move off screen. This is done by having different tiles represented by different animation frames of one sprite.

    http://dl.dropbox.com/u/5426011/examples14/tilesFromArray.cap

  • #1 is just math.

    If the origin of your minimap sprite is at the top left then a mouse click can be converted to layout coordinates with these expressions:

    x:

    lerp(0,LayoutWidth, unlerp(minimap.X, minimap.X+minimap.Width, Mouse.X))

    y:

    lerp(0,LayoutHeight, unlerp(minimap.Y, minimap.Y+minimap.Height, Mouse.Y))

  • The "focus off" action is what's giving the trouble. A better way to remove focus is to give something else focus or destroy the object.

  • Have you tried the minimap object? It has a draw terrain action that uses the image of an object to draw.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound