Silent Cacophony's Recent Forum Activity

  • Very nice! I had no idea about that font.

    It was quite horrible too look at without that font installed.

    Thanks for the info

  • Here is a simple high score method:

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

    I just made some simple calculations on the position of the gbm every tick, using Sprite3.Top as ground coordinate, and offsetting for the centered hotspot of the gbm. It's not exact if the sprite is sideways, but it would likely be overkill to nitpick that.

    The black bars were adjusted to be centered 500 pixels from top of the ground sprite, and each other, and that represents 10m, hence the '/ 50' in the arithmetic.

    The highest point is determined by comparison between two variables. A fairly common method that one might employ in such a situation.

  • Glad you guys liked it. I'll likely be posting further examples and updates occasionally in this thread, as I continue my work on making a roguelike game.

    My next steps will probably be to make a Dungeon class to contain the levels, with a way to connect the levels to each other, and getting a character moving around within it. Not very difficult stuff, but my time is more limited than I'd like these days. Things like filling the dungeon with random stuff and creatures will follow, here.

    I'll also likely be cross-posting this project across different threads later, as I get to field-of-vision and line-of-sight examples, and other different topics that will crop up with it.

  • Steven solved the logic problem nicely with the check for being 'active', but on my machine, there is a different problem that remains:

    + Sprite2: On collision between Sprite2 and Sprite2

    That causes somewhat random crashes on my machine. Construct has no good way to differentiate between the two different instances of Sprite2 there, and it seems to cause problems.

    In the event that you've not had to deal with such a problem before, I'll discuss a common way to deal with it.

    The easy way to deal with needing to pick two different instances of the same object in the same event is to add that object into a family (let us use Blue family.) Here, if a Sprite2 is 'active' and has collided with any other Sprite2, the other Sprite2 is also set to 'active':

    + Sprite2: Value 'active' Equal to 1

    + Sprite2: On collision between Sprite2 and Blue

    -> Blue: Set 'active' to 1

    In this way, any actions performed upon Sprite2 within that event will only affect Sprite2 objects that have the 'active' var set and have collided with a Blue family member (which only contains Sprite2 objects here.) Any actions performed upon Blue in that event will only affect the Blue member that was collided with by the aforementioned Sprite2 object.

  • I can't think of a reasonable way to make an editbox accept only numbers, without using Python. So, here's a way with Python:

    EditBox: On text changed

    if len(EditBox.Text) > 0 and not EditBox.Text.isdigit():
    	EditBox.Undo()
    EditBox.ClearUndo()[/code:1au5r3n3]
    
    The python script would just be indented within the 'On text changed' condition. This makes use of, and basically takes away from the user, the ability to undo changes in the Editbox.
  • Well, it's quite a bit later than I expected, but I finally got some time to rewrite this thing in Python. It's a fairly straight conversion of the prototype version, with a simple slider-driven interface wrapped around it to demonstrate it's possible usage.

    The sliders were given private variables with reasonable ranges for the parameters, which can be changed in the layout editor if need be. The actual acceptable limits of the parameters are commented upon in the script, and are not checked by it. The user should handle making sure that the parameters are within range.

    I'm uploading two files. Each has the same script defining the classes, but each uses it in a slightly different way. The first one keeps things simple and uses a Text object to display the level, and the second one uses a method to copy the level data into a Construct Array, and uses a Canvas object to display the Array data.

    Requires Construct v0.99.95 or newer. Attachments are below:

  • [quote:32womvdf]you might be able to save sometime by using a dictionary

    That's probably a good idea. Could this be used to substitute for an array? I wouldn't be using it to save the game, but it would store values with 3 keys (ex. (x,y,z) or (1,2,1)).

    Though it's a bit irregular, a dictionary using tuples as keys can be used as a sort of multi-dimensional array. Also, a dict's get() and setdefault() methods can provide easy handling of cases where keys are not there yet. Here's a simple example:

    http://www.daniweb.com/code/snippet275835.html

    With that pointed out, I'd just use lists in most cases.

    [quote:32womvdf]Edit: Is there a limitation on how many lines of script you can have?

    I got up to 65 and nothing after line 65 gets executed.

    I've got a few scripts well longer than that, with no problems.

  • Some additional info:

    [quote:28x1cczu]I assume XAudio2 is the default name of the XAudio2 object when you first add it in, which can be renamed.

    This is true with any object in Construct. If you build expressions by point-and-click, the proper name will always be used, but you can also just type in expressions if you are familiar with the syntax, in which case you must type the proper name.

    Also, one of the pages that I find most useful in the wiki is on the System Object:

    http://sourceforge.net/apps/mediawiki/c ... tem_Object

    It can provide some insight on what Construct considers conditions, actions, and expressions to be, and how to use the many general purpose ones provided by the System Object.

    It should also be noted that you can access any condition, action, and expression through the mouse-driven interface, sometimes with minor editing of their arguments.

  • Regarding your first question, most any action that lets you set a given property of an object has an expression counterpart that lets you read the current value. In this case, you can simply increment or decrement the current value by a given amount.

    This would increase channel 1 volume and decrease the master volume:

    + On whatever triggers a volume change

    -> XAudio2: Set channel 1 volume to XAudio2.Volume(1) + 1 dB

    -> XAudio2: Set master volume to XAudio2.MasterVolume - 1

    I don't know about the second question.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi. I've run across several actions that don't work with the Windows API objects such as the editbox as well. This seems to be one of them.

    I'd suggest one of two options that I can think of:

    • use a variable of some sort to keep a copy of the text in the editbox when it's not needed (if you need the contents to be persistent,) and destroy it when it's not needed. You can create a new one and copy the variable into it when it's needed. You can also use variables to save the EditBox.SelectionStart and EditBox.SelectionEnd properties, and use EditBox.SetSelection() after creation to reset the cursor position to what it was.
    • set it's position out of the visible layout area and disable it and/or turn the focus off of it when not needed. You can then move it back, enable it and/or turn the focus back on when needed.
  • i51.photobucket.com/albums/f355/pooiyx/howtouseglobalvariables.png

    For the layout's width, I've tried writing

    Stage 0 Width

    and

    "Stage 0 Width"

    but they are not accepted.

    How do I use global variables in this case?

    For the record, if you are using it in an expression, it would be:

    global('Stage 0 Width')

    Otherwise, if you use the Compare global variable system condition, you just select it from the drop-down list.

    Note the use of the single quotation marks. They are reserved for identifying variables in Construct. Also, be careful of using whitespace in the names. Make sure that you don't have extra spaces or whatnot... I prefer not to use spaces in names (i.e.: Stage0Width.) Not sure if I've ever tried it, actually.

  • Just thought that I'd point out a possible workaround to using the OR condition. I've found that most anything that I've wanted to use it for can be done just as well with the system condition Evaluate, using the OR operator in an expression form. Like so:

    + System: global('x') = 2 or global('x') = 5

    -> Do something...

    It has not caused me any problems, and allows for more complex logical tests in less space. Parentheses and the AND operator can be used to group parts of the expressions as appropriate, too. Perhaps something like so:

    + System: (global('x') = 2 and global('y') > 6) or (global('x') = 5 and global('y') <= 6)

    -> Do something...

    I've gone to this every time that the OR condition seemed to be causing me problems, and it worked.

Silent Cacophony's avatar

Silent Cacophony

Member since 11 Mar, 2010

None one is following Silent Cacophony yet!

Trophy Case

  • 14-Year Club

Progress

14/44
How to earn trophies