R0J0hound's Recent Forum Activity

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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

  • Use a variable to store the state of each key you use and update them with keyboard and touch events. Then in the rest of your event just compare their value to see the state.

  • How about one key with an array.AsJSON saved into it, where the array has all the level info in it.

  • You could do lasers like this in post:

    http://www.scirra.com/forum/laser_topic44612_post279569.html#279569

    Make it work for multiple lasers by add a "for each laser" to the top of event two.

    You can adjust event two so that you get better performance by decreasing the repeat count and increasing the amount you lengthen the laser. It's just a balance between performance and accuracy, but also keep in mind that both numbers multiplied together also define the range of the laser. In the example the range is 30*20 or 600 pixels.