Silent Cacophony's Forum Posts

  • Python is often named as a good first programming language to learn, and it's definitely useful as well. It's my favorite language yet, personally. It's also the one that led me to 'get' the usefulness of object-oriented programming, though it supports multiple programming paradigms as C++ does.

    I like dynamically-typed, interpreted languages with garbage collection, and Python fits the bill quite well. IMO, this allows you to focus more on solving the problem, and helps in learning and debugging.

    Possible downsides are that it's not as fast as a compiled language, and it's not well-suited to closed-source development.

    It is easier to port programs written in it across multiple platforms, though. For the most part, they just work.

    I picked it up after getting Construct a few months ago, and I feel quite proficient in it, having written several programs for my own use, and one for work in that time.

    I can see myself tackling C++ eventually, because of the ability to write plugins. Because Python and C++ can be intermingled in other projects, as well.

  • I don't know much of C++, but I did program in C long ago. C++ kind of scared me off back then, because it wasn't widely used, and it seemed unnecessary to me. The scene has changed a bit, though.

    In my opinion, any programming language, if you have a good reason to use it, is useful to learn. C++ can be used to create pretty much any software project, so it definitely should be considered useful. I'd also venture to say that once one learns C++, pretty much any other language should be easy to learn after that.

    On the other hand, there are some definite drawbacks to using C or C++, if you don't need it's unique abilities. While some prefer such things, I have moved away from statically-typed, compiled languages where you have to manage every aspect of your program's memory usage yourself. I don't need that.

    There are some solutions to make memory management easier, though. If you aren't careful about how you develop in C++, you can get some very hard to find bugs with bad pointers and such.

    It does have a huge amount of libraries that can be used. All of them aim to make certain tasks easier. Just have to be able to find the right ones for you, which can take time.

    Anyway, if you anticipate speed problems with your project, it's definitely a good solution to that problem.

  • Hi. I haven't been able to get Python to work at all in Construct lately (not sure why, but may be due to re-installing Windows XP, somehow), so I can't test whether I can get that to work.

    One thing that comes to mind: If you are using the 'System->Run Script' action or the 'System->Evaluate python command' expression, which must have the command enclosed in double-quotes("), then you should use the single-quotes (') around strings within those. No need to worry about that if you are inserting the script into the event sheet, though.

    It may just not work, in which case you can roll your own with Python, if you like. For example, this would be very similar:

    def getToken(string, num, delimiter=','):
    	try:
    		return string.split(delimiter)[num]
    	except IndexError:
    		return ''[/code:lynp8a7d]
    
    It handles out-of-range indexes by returning empty strings, but indexes are zero-based instead of one-based, as Construct uses. It also allows negative indexes, which count backward from the end.
    
    You can include your own functions like that by adding them into a 'Start of Layout' condition, since they need only be defined once.
  • Here's another example, with a way that you can use multiple image points:

    http://dl.dropbox.com/u/5868916/ImagePoints.cap

    Check out the private variables on the individual satellites, and the image points on the orbit object. The strings match, so you can use that with a 'for each' condition to easily set them all to the correct position.

    Also be sure not to include quotes around the strings in variable editors for private and global variables, but do use them in any expressions in your actions. Construct is a bit ambiguous there.

  • What he said, and since you were giving random() a floating-point number ( . = decimal point here, to be clear), it was generating one of those from 0 up to (not including)1.5, therefore making it impossible to match anything but the name for 1, which would still be a long-shot. Feed it an integer, and it acts as Citnarf said.

    Also, you could replace all of those events for the different names with something like this:

    + System: Is global variable 'person1_number' Greater than 0

    -> person1: Set text to {"Breen","Alyx","Barney","Freeman","Lammar"} global('person1_number')

    That expression returns the array value at the index provided, which is the global there.

    You can do a similar thing with the system expression GetToken and a string, as well. There is more info on that here: http://sourceforge.net/apps/mediawiki/c ... xpressions.

    Both of those use 1-based indices instead of 0-based.

    Anyway, I'm not looking for any credit for that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi. I don't know of any tutorials on such a game. I made a simple example of how one might do such things, though (v0.99.92): http://dl.dropbox.com/u/5868916/Artillery.cap

    A power bar can be pretty easy to do. Could use a progressbar object, I suppose, but I'd prefer a sprite in most cases. I just used it's width as the measure of power. I surrounded it with a box object for a visual on what the max would be... EDIT: Just remembered that I used a tiled background object for the bar, because it generally scales better than a sprite, in my opinion.

    Though this is the first time I've tried the Physics behavior, it seems to lend itself well to such a game, so I used that. The attributes of that behavior can be tweaked as needed. Just one action containing a few simple calculations sets the projectile in motion at the proper angle and speed.

    It uses the RMB to set angle and the LMB to set power.

  • I have been vexed by that as well. I don't think it can be changed. Because it's a windows API widget, it's not quite as integrated into Construct as most other objects. For instance, it can't be zoomed.

    Anyway, you might be able to make an acceptable alternative. linkman2004 made an example of a custom editbox a while back. It uses a hidden editbox to do the grunt work, while a Text and Box object make up the visible display. Something like that can be adapted to work with multiple fields.

    Check it out here:

    http://www.scirra.com/forum/viewtopic.php?f=16&t=5686&p=45360#p45360

    Another alternative that I just thought of, would be trying lucid's spritefont plugin. There is a recent tutorial that mentions using it as an editbox, here:

    http://www.scirra.com/forum/viewtopic.php?f=8&t=6867

    The plugin is linked to in that thread as well.

  • Hi. It's best to think (anti)clockwise with angles. Construct goes from right-facing at 0 degrees, clockwise as the angle increases.

    The math is a bit of a pain when having to deal with the transition at 360/0, but Construct already has a condition for this in the System object, way at the bottom, under 'Values' - 'Angle is clockwise of...'

    You can test for either clockwise or anticlockwise, but it's best to only test if you've determined that the angle has changed, because it tests true with no change.

    I made a quick example here:

    http://dl.dropbox.com/u/5868916/Angles.cap

  • I like the style quite a bit. Keep up the good work!

  • I like Construct's TokenString system expressions for things like this. They are just string variables with different fields separated by some character or string. In this case, I'd use a TokenString with NewLine separators, where each field is another TokenString with a '|' separator, containing each question and answer pair.

    I made a quick example of such a method, here:

    http://dl.dropbox.com/u/5868916/MathQuiz1.cap

    It's not commented, and quickly written, but it should get the idea across. It's fairly dynamic, and can help keep the number of events down. If anything in it sparks your interest, and you have any questions, I'll check back when I have more time.

    Basically, you can just double-click the text object above the layout, and enter each 'question|answer' pair on a new line in the popup editor, then run it to test it out. You can end the question list with a NewLine or 'END'.

    Also, You can also just read 'enter key pressed' instead of using a button if you like.

    It assumes all answers are numbers, and converts the strings to floating-point numbers. This can be a bit tricky, if you work with floats. This example uses the system expression FormatDecimal to round off the numbers, but I'm not sure that it works as I would expect it to. May just have to specify that all answers follow a certain format at the beginning of the quiz...

    The data structures that scidave mentioned can also be used in much the same way, though setting them up may require more steps.

  • That looks really cool! Does look like a bit of a cpu/gpu hog, but that's to be expected for such an impressive display.

    Good luck with the continued development.

  • Nice. I like the picking of a random ground tile to expand from instead of a wall tile, too.

    Also i couldn't get your idea of checking to see if the space is occupied before placing the tile to work exactly as you had it written down for some reason, so its slightly different now:

    I tried it with the check for a wall tile, and destroying it if so, and it worked as I expected. Here's a modified version of the V2 .cap:

    http://dl.dropbox.com/u/5868916/DungeonGenV2Modified.cap

    Just one event bracketed by red comments added to the MakeRoom function. I tested it in a copy of that, where I counted overlapping tiles at the end, and came up with zero each try, so it should eliminate all overlapping tiles.

  • That's pretty cool. I've played around a bit with some random dungeon generator ideas, and they can get quite complex. I've decided to use Python for such a thing, unless it's pretty simple.

    A couple of notes about this come to mind. I noticed that you had trouble with setting a global variable to the user-input room number, and just set it to a static 99 instead. This can be done by coercing the string value into a numerical value by using the system expression int() or float(). In this case, you'd prefer an integer over a floating point number, so you can do it like so:

    + cmdGenerate: On cmdGenerate clicked

    -> Wall: Destroy

    -> Ground: Destroy

    -> System: Set global variable 'NumRooms' to 0

    -> System: Set global variable 'MaxRooms' to int(txtNumRooms.Text)

    -> Function: Call function "MakeFirstRoom" (and Forget picked objects)

    Also, I noted that a 100-room dungeon ends up creating around 5,200 wall tiles and 15,300 ground tiles, then reduces the number of wall tiles to 400-700 or so after destroying the ones that overlap ground tiles. This leaves a lot of 'stacked' ground tiles that are unnecessary. It also may need two passes to remove all of the extra walls, since it's doing all of that in a single tick, and Construct only updates such changes at the end of the tick.

    I would probably avoid creating all of the extra tiles by using the system condition object overlaps point to test of a tile already exists at the current drawing location. Putting the wall and ground tile objects together into a family (say, 'blue') would simplify things. Then the drawing part could be done something like so (in pseudocode):

    if (wall tile):
        if (family blue does not overlap drawing location):
            draw wall tile
    if (ground tile):
        if (wall tile overlaps drawing location):
            destroy wall tile
        if (family blue does not overlap drawing location):
            draw ground tile[/code:3l5u20o5]
    
    That assumes that the wall tiles will be destroyed instantly, and the next check will not see a 'blue' there afterward. I'm not sure if that's the case, but otherwise one could add another 'draw ground tile' after the 'destroy wall tile', I guess.
    
    Any rooms that are inaccessible at the end could be dealt with by running through all walls with a 'for each wall', and checking for the presence of a ground tile either [i]both[/i] north and south of it, or [i]both[/i] east and west of it, and replacing the wall tile with a ground tile if either is true.
    
    Of course, there are tons of other things that one could do with it, too.  But it starts to become a beast at some point along that road.
  • Ah. Well, it should work the same way for a family. With family 'Red':

    -> Red: Set speed to Red[RTS].Speed - 10

    just select the family in place of the sprite.

    There is a completely non-obvious method that you may have to use in place of the above:

    - double-click the sprite again in the object view at the bottom of the window. This brings up all of the expressions for it.

    in order to be able to select the family, though... If the family is not in that list, you can double-click an empty spot in the little window to bring up a new window with all of the objects and families, and select it there.

    Or just type it in if you already know the syntax.

  • I remember trying that 'trigger once while true' condition first, and found it unreliable in my case. I could not find any obvious reason why, though. Maybe the events were too complicated, and I couldn't spot an error, but I ended up using the method that I mentioned above. That was several versions of Construct ago, though.

    If the 'trigger once' works for you, then that that's pretty simple. Just add it to the condition. It does the same thing for you, without the overhead of the extra variables and events.

    I have found that 'trigger once' works as expected most of the time when I use it, which is seldom.