Silent Cacophony's Forum Posts

  • I've never tried full screen with an editbox until now, and I see it doesn't work correctly.

    I would guess that it doesn't work well because full screen uses DirectX to display, and it doesn't play well with Windows API. I don't know...

    I don't see a way to fix that, other than not using full screen.

    Perhaps you can use the Text object, or SpriteFont Plugin to do the display portion instead of the EditBox. If input is needed, there is an Input plugin in the WIP plugins forum that could be used for that. I'm sure that it's possible to emulate an EditBox.

  • The EditBox is a Windows object, so it does not behave like most other Construct objects do, such as sprites.

    I'm not aware of any way to change any of the things that you have mentioned, other than the position and size of it.

    I don't think that there is a 'On window resized' condition, but you could store the current size at start of layout in a couple of global variables, and compare those against the current size each tick, then resize the EditBox based upon the change if they are different. Then set the stored size to the current size...

    The System object has expressions under it's Display category for the display size, and the Window object has similar expressions for window size.

  • Hi. In my experience, those options just make it so that the text contained by the EditBox can be larger than the box itself.

    If you're looking to make it scroll so that you can see text that has been added to the EditBox through events, you can use the EditBox's Set Selection action to force it to show any area in the text.

    The following simple example would add the amount of time that the application has been running in a new line each time the LMB is pressed, then set a null-selection the end of the text.

    + MouseKeyboard: On Left mouse button Clicked

    -> EditBox: Append text Timer & NewLine

    -> EditBox: Select characters len(EditBox.Text) to len(EditBox.Text)

  • Thanks for the example, I was looking for something like it.

    Can you show me how to change the script to use double digit numbers?

    That's actually pretty simple. The .split() method does that nicely. Then I just convert the string values to integers.

    Change this:

    l.append([int(i) for i in j if not i.isspace()])

    to this:

    l.append([int(i) for i in j.split()])

    But, as R0J0hound pointed out with his example, parsing the text in Construct can be quite simple. It works much the same way, as well.

    Reading it in from a file should be pretty simple, though I've never done it. It looks as if an EditBox, or the Binary object can do it. Probably other ways, too.

  • Hi. 'On a certain button clicked' type events will be true throughout the event sheet for the tick that it is true for that button, so all of those will execute in order.

    Arranging them like so should work, assuming that 'ChoiceA' is zero by default:

    On clicked Button:
          Value "ChoiceA" equal to 0
                a.Write Text
                b. Button.Set"ChoiceA" to 1
          Else
          Value "ChoiceA" equal to 1
                a.Write second Text
                b.Button.Set"ChoiceA" to 2
          Else
          Value"ChoiceA" equal to 2
                a.Write third Text[/code:11fyr41t]
    
    Then you may need to reset 'ChoiceA' to zero or something that doesn't apply to those conditions, afterward, depending upon your needs.
    
    All of the 'ChoiceA' tests are sub-events of the 'clicked button' event, and the Else conditions make sure that only one is true per tick.
    
    Tulamide made a nice tutorial on that subject a while back: [url=http://www.scirra.com/forum/viewtopic.php?f=8&t=6880]Introduction to branching[/url].
    
    That may help clear up the event logic for you.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For most behaviors, the object's direction is it's angle property, which defaults to zero (which is right.)

    Beyond that, you can make objects move in move in other ways, too, in which case you may want to store the direction in a private variable for the object. Picking a random direction can be set up with simple events, using the system random() expression.

  • For your first problem, the usual method is to add the BB objects into two different families. That will allow you to pick two differing instances by family. Say you're using green and red family names:

    For each paired entity, pick it's green

    If green overlaps red

    If red is moveable

    >> Have green and red push each other in opposite directions

    > If red is static

    >> Have the green completely push itself out of red

    ... it's assuming that green is moveable ... also, the 'for each' should be literal, to be clear. There is a condition for that.

    As for the other two questions, I've not used these ideas, but these two threads may help a bit:

    .

  • Hi. It's really difficult to pinpoint these types of problems without being able to see the events, but I'll throw a couple of ideas out...

    It sounds as if the logic is flawed. Go through the events, thinking of them in sort of a flowchart way, and see if whatever state variables/conditions you're using actually keep the state from advancing to the next step until the proper user input is had. For instance, if you used a variable to temporarily signal a transition, then you'd usually need to set it back to zero/off upon that transition, so that it won't go to the next immediately.

    Also, make sure that you are using a 'button clicked' condition, and not a 'button down' condition. That's a common mistake.

    Not sure what else may cause your problem.

  • [quote:37w7yvur]i want var ShieldsCurrent value to be downgraded to ShieldsTotal value. so you know, whenever it goes over ShieldsTotal var value it is fixed down.

    In that case, it's always better to simply not allow that to happen. You can either test it first, then only set it if it will remain valid, or clamp it's value while setting it.

    I made a simple example .cap (with Construct v0.99.96) that shows a bit of dealing with percentages, clamping values, and testing for ranges.

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

    Good luck.

  • I'm not sure what you want to do with the file, still, but I did a bit of experimenting in my PyShell:

    >>> with open("grid.txt") as f:
    	s = f.read()
    	
    
    

    s

    '4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n4 4 4 4 0 0 0 0 0 0 0 0 0 4 4 4 4\n4 4 4 0 0 0 0 0 0 0 0 0 0 0 4 4 4\n4 4 0 0 6 8 8 8 6 8 8 8 6 0 0 4 4\n4 4 0 0 8 4 4 4 4 4 4 4 8 0 0 4 4\n4 4 0 0 8 4 4 4 4 4 4 4 8 0 0 4 4\n4 4 0 0 6 4 4 4 4 4 4 4 6 0 0 4 4\n4 4 0 0 8 4 4 4 4 4 4 4 8 0 0 4 4\n4 4 0 0 8 4 4 4 4 4 4 4 8 0 0 4 4\n4 4 0 0 6 8 9 7 4 7 9 8 6 0 0 4 4\n4 4 0 0 0 0 0 0 4 0 0 0 0 0 0 4 4\n4 4 4 0 0 0 0 0 4 0 0 0 0 0 4 4 4\n4 4 4 4 0 0 0 0 4 0 0 0 0 4 4 4 4\n4 4 4 4 4 4 0 0 4 0 0 4 4 4 4 4 4\n4 4 4 4 4 4 0 0 4 0 0 4 4 4 4 4 4\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4'

    with open("grid.txt") as f:

    s = f.readlines()

    s

    ['4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n', '4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n', '4 4 4 4 0 0 0 0 0 0 0 0 0 4 4 4 4\n', '4 4 4 0 0 0 0 0 0 0 0 0 0 0 4 4 4\n', '4 4 0 0 6 8 8 8 6 8 8 8 6 0 0 4 4\n', '4 4 0 0 8 4 4 4 4 4 4 4 8 0 0 4 4\n', '4 4 0 0 8 4 4 4 4 4 4 4 8 0 0 4 4\n', '4 4 0 0 6 4 4 4 4 4 4 4 6 0 0 4 4\n', '4 4 0 0 8 4 4 4 4 4 4 4 8 0 0 4 4\n', '4 4 0 0 8 4 4 4 4 4 4 4 8 0 0 4 4\n', '4 4 0 0 6 8 9 7 4 7 9 8 6 0 0 4 4\n', '4 4 0 0 0 0 0 0 4 0 0 0 0 0 0 4 4\n', '4 4 4 0 0 0 0 0 4 0 0 0 0 0 4 4 4\n', '4 4 4 4 0 0 0 0 4 0 0 0 0 4 4 4 4\n', '4 4 4 4 4 4 0 0 4 0 0 4 4 4 4 4 4\n', '4 4 4 4 4 4 0 0 4 0 0 4 4 4 4 4 4\n', '4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n', '4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n', '4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n', '4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n', '4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\n', '4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4']

    l1 = []

    > for j in s:

    l1.append([i for i in j if not i.isspace()])

    l1

    [

    ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '0', '0', '0', '0', '0', '0', '0', '0', '0', '4', '4', '4', '4'], ['4', '4', '4', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '4', '4', '4'], ['4', '4', '0', '0', '6', '8', '8', '8', '6', '8', '8', '8', '6', '0', '0', '4', '4'], ['4', '4', '0', '0', '8', '4', '4', '4', '4', '4', '4', '4', '8', '0', '0', '4', '4'], ['4', '4', '0', '0', '8', '4', '4', '4', '4', '4', '4', '4', '8', '0', '0', '4', '4'], ['4', '4', '0', '0', '6', '4', '4', '4', '4', '4', '4', '4', '6', '0', '0', '4', '4'], ['4', '4', '0', '0', '8', '4', '4', '4', '4', '4', '4', '4', '8', '0', '0', '4', '4'], ['4', '4', '0', '0', '8', '4', '4', '4', '4', '4', '4', '4', '8', '0', '0', '4', '4'], ['4', '4', '0', '0', '6', '8', '9', '7', '4', '7', '9', '8', '6', '0', '0', '4', '4'], ['4', '4', '0', '0', '0', '0', '0', '0', '4', '0', '0', '0', '0', '0', '0', '4', '4'], ['4', '4', '4', '0', '0', '0', '0', '0', '4', '0', '0', '0', '0', '0', '4', '4', '4'], ['4', '4', '4', '4', '0', '0', '0', '0', '4', '0', '0', '0', '0', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '0', '0', '4', '0', '0', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '0', '0', '4', '0', '0', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4']]

    l2 = []

    > for j in s:

    l2.append(j.split())

    l2

    [

    ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '0', '0', '0', '0', '0', '0', '0', '0', '0', '4', '4', '4', '4'], ['4', '4', '4', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '4', '4', '4'], ['4', '4', '0', '0', '6', '8', '8', '8', '6', '8', '8', '8', '6', '0', '0', '4', '4'], ['4', '4', '0', '0', '8', '4', '4', '4', '4', '4', '4', '4', '8', '0', '0', '4', '4'], ['4', '4', '0', '0', '8', '4', '4', '4', '4', '4', '4', '4', '8', '0', '0', '4', '4'], ['4', '4', '0', '0', '6', '4', '4', '4', '4', '4', '4', '4', '6', '0', '0', '4', '4'], ['4', '4', '0', '0', '8', '4', '4', '4', '4', '4', '4', '4', '8', '0', '0', '4', '4'], ['4', '4', '0', '0', '8', '4', '4', '4', '4', '4', '4', '4', '8', '0', '0', '4', '4'], ['4', '4', '0', '0', '6', '8', '9', '7', '4', '7', '9', '8', '6', '0', '0', '4', '4'], ['4', '4', '0', '0', '0', '0', '0', '0', '4', '0', '0', '0', '0', '0', '0', '4', '4'], ['4', '4', '4', '0', '0', '0', '0', '0', '4', '0', '0', '0', '0', '0', '4', '4', '4'], ['4', '4', '4', '4', '0', '0', '0', '0', '4', '0', '0', '0', '0', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '0', '0', '4', '0', '0', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '0', '0', '4', '0', '0', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4'], ['4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4']]

    l3 = []

    > for j in s:

    l3.append([int(i) for i in j if not i.isspace()])

    l3

    [

    [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4], [4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4], [4, 4, 0, 0, 6, 8, 8, 8, 6, 8, 8, 8, 6, 0, 0, 4, 4], [4, 4, 0, 0, 8, 4, 4, 4, 4, 4, 4, 4, 8, 0, 0, 4, 4], [4, 4, 0, 0, 8, 4, 4, 4, 4, 4, 4, 4, 8, 0, 0, 4, 4], [4, 4, 0, 0, 6, 4, 4, 4, 4, 4, 4, 4, 6, 0, 0, 4, 4], [4, 4, 0, 0, 8, 4, 4, 4, 4, 4, 4, 4, 8, 0, 0, 4, 4], [4, 4, 0, 0, 8, 4, 4, 4, 4, 4, 4, 4, 8, 0, 0, 4, 4], [4, 4, 0, 0, 6, 8, 9, 7, 4, 7, 9, 8, 6, 0, 0, 4, 4], [4, 4, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4, 4], [4, 4, 4, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 4, 4, 4], [4, 4, 4, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 0, 0, 4, 0, 0, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 0, 0, 4, 0, 0, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]][/code:1l52u2pk]

    Assuming that you don't want the spaces in the final data structure, and you want numerical values instead of characters, and that you may want to use Construct's array object, I made a simple .cap that demonstrates how you can load the data file into both a 2D python list and a 2D Construct array.

    http://dl.dropbox.com/u/5868916/grid.zip

    The text file should be in the same folder as the .cap in it's current form, is all.

  • I want to use txt file to make my game level with python

    but I don't now the best way of doing it. can anybody help me out.

    I can't quite figure out what it is that you're wanting from that. Can you be more specific?

    Python has really nice text processing abilities, so it sounds quite feasible.

    Do you want to design levels using a text file, then read it into variables using Python? If so, what format would you use? Graphical representation (like arranging characters in a grid pattern to represent the layout), or descriptive (like an .ini file?)

    What type of level? Top-down (like a dungeon level), or side-view (like a platformer?)

    Or, do you want to use Python to procedurally generate the level, then store it in a text file? The generation would be the hard part there. Storing string variables into text files is pretty easy, though. I have an example of procedural generation using python, here. It would be easy to store the results as a text file in that example.

  • i have problem with setting up a basic "ON/OFF" switch based on variables. of course - if you now a way to do this other then by variables feel free to enlighten me.

    what i want/need:

    When pressing "F1" i want something to move from one place to another, and when pressing F1 again to go back. imagine it like a UI moving from outside of the screen down vertical into the screen, and then going back. bear in mind its not about X/Y position, but actual sliding from point A to B and from B to A.

    what i used:

    ive set up variable "Switching"

    IF key F1 pressed=>
                If variable =0 : 
                               1. move Object verticaly 150
                               2. Set variable to 1
                                     
                if variable =1:
                              1. move Object verticaly -150
                              2. Set variable to 0[/code:1yfih4yu]
    
    and that should work... but it doesnt. most of the time it goes randmly up and down like it would ignore the chanching variable. is there a way to make so that F1 key will be disabled until the variables switches?
    

    Arima's solution is an elegant one for this case, but it may not apply well to all conditional branching situations that you may come across, so I'll point out another way: ELSE.

    ELSE is a system condition that can be used to make sure that only one of the conditions is true in any tick. You had the logic very close to correct for that case:

    IF key F1 pressed=>
                If variable =0 : 
                               1. move Object verticaly 150
                               2. Set variable to 1
                                     
                ELSE:
                              1. move Object verticaly -150
                              2. Set variable to 0[/code:1yfih4yu]
    
    Also you could extend it to a 3-state or more check in similar fashion:
    
    [code:1yfih4yu]IF key F1 pressed=>
                If variable =0 : 
                               1. move Object verticaly 150
                               2. Set variable to 1
                ELSE
                If variable =1 :
                              1. move Object verticaly -150
                              2. Set variable to 2
                ELSE
                If variable =2 :
                              1. spin Object 360 degrees
                              2. Set variable to 0[/code:1yfih4yu]
  • I've looked at LOGO in the past, but I've never used it for anything. It does look to be a good first step.

    That said, my first programming language was commodore 64 BASIC, and I think it was great for beginning programmers, aside from the prevalence of the much disparaged GOTO statement.

    A slightly more modern basic that I liked, which still has a good following is QBASIC. It is a bit better at relating well to the more modern programming languages. Small Basic looks to be a good modern solution, to me.

    A couple of links I had related to this, that you may want to read:

    http://tedfelix.com/cs4kids/

    http://www.tedfelix.com/qbasic/

    Good luck! I think you have a good idea, there.

  • Hi. First, I'll point out that the normal jump works automatically, by pressing the shift key.

    That said, you can make your custom jump work normally by adding another condition to test if the character is on ground to the the event, like so:

    + MouseKeyboard: On key Up arrow pressed

    + blank_character: is on ground

    -> blank_character: Jump

    That will prevent it from jumping again while it is jumping or falling.

  • + MouseKeyboard: Key Space is down
        + System: Is global variable 'Timestamp' Equal to 0
        -> System: Set global variable 'Timestamp' to Timer
        + System: Else
        -> System: Set global variable 'Duration' to Timer - global('Timestamp')
    
    + MouseKeyboard: On key Space released
    -> System: Set global variable 'Timestamp' to 0
    -> System: Set global variable 'Duration' to 0
    
    + System: Always (every tick)
    -> EditBox: Set text to global('Timestamp') & " : " & global('Duration')[/code:2bb1jypp]
    
    Copied as text from Construct, the above is probably how I'd do it. The indented lines are sub-events. The Editbox was just a simple way to display the variables in real time.
    
    Depending upon your needs, you may not need two variables. The above will need the timestamp to be stored, at least.
    
    You could also use a variation that adds TimeDelta to a duration variable every tick while the key is down, and sets it to zero when released...