R0J0hound's Forum Posts

  • Here is a starting point:

    http://dl.dropbox.com/u/5426011/examples14/word_highlight.capx

    It finds the position of a word and then breaks the text into 3 separate instances (text prior to word, word, and text after). You can then change to color of the word independent of the rest of the text.

    In it's current state it only works with one text line, and finds only one word to highlight.

    Here's a list of what could be done to enhance the technique in roughly increasing difficulty:

    * Make it work with multiple text objects.

    * Make it highlight all occurrences of a word in a line.

    * Make it able to highlight different words to different colors.

    * Make it work with multi-line text.

    I would take a look at the plugins to see if there are any that allow for displaying formatted html text as that would simplify it by replacing words like "green" with say "[_COLOR=#00ff00_]green[_/COLOR_]".

  • Tiledbg was faster at drawing in CC, and last I checked my testing showed the same is true in C2.   It's only a bit faster though.

    ElRei

    You could try your hand at plugin making to make such an object, reusing code from Tiledbg and sprite.

  • TiledBG does draw faster than Sprites, that could be the reason. Does the fps still drop if everything is invisible?

    The only other way for collisions to be tested every frame is if the object has the solid behavior and there is another object with a behavior that reacts to solid.

  • Hmm.. that's from a rounding error.

    Here is a corrected capx without log10():

    http://dl.dropbox.com/u/5426011/examples14/format_number2.capx

  • Well along with the "for each element" condition there is the "set value at X,Y,Z" action to set the value, and the "Array.CurrentX", "Array.CurrentY" and "Array.CurrentZ" expressions to loop through the indexes.

  • sqiddster's correct, they only check for collisions every tick if you add a event to check for collision every tick.

  • All the variables/methods relate directly to Actions/Conditions/Expressions. You can get the list in the script editor by typing "Sprite." and the right hand side should show them all.

    You can also find the names of the variables/methods by using the dir() function in this interactive python shell:

    http://69.24.73.172/scirra/forum/viewtopic.php?f=8&t=6158&p=49059&hilit=Python#p49059

    For accessing the picked objects use "SOL.Sprite".

    ex:

    "Sprite.X" is the x position of the first instance of Sprite

    "Sprite[1].X" is the x of the second instance.

    "SOL.Sprite.X" is the x of the first picked instance.

    "SOL.Sprite[1].X" is the x of the second picked instance.

    Some other links:

    intro http://69.24.73.172/scirra/forum/viewtopic.php?f=8&t=5397&start

    wiki http://sourceforge.net/apps/mediawiki/construct/index.php?title=Python_Scripting

  • xyboox

    Yes, that is possible, but instead of using the IID to access the points store all the points in an array.

    Then do these changes to the expressions:

    p(n).x -> Array.At(n % Array.Width, 0)

    p(n).y -> Array.At(n % Array.Width, 1)

    p(n+1).x -> Array.At((n+1) % Array.Width, 0)

    p(n+1).y -> Array.At((n+1) % Array.Width, 1)

    p(n-1).x -> Array.At((n-1) % Array.Width, 0)

    p(n-1).y -> Array.At((n-1) % Array.Width, 1)

  • Try Construct 3

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

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