rexrainbow's Forum Posts

  • I'm trying to use python as more as possible.

    Python is cool. For example, "execfile(FILENAME)" can load python script into event sheet, even if the cap file has been exported to exe file.

    It means someone can customize the game by change the python script without cap file.

  • Here is the test cap file:

    http://dl.dropbox.com/u/5779181/objspv_access.zip

    There are many instances of objA. I try to attach a new member named "_value" on each instance.

    for _obj in objA:
        _obj._value = 10
    _obj = objA[0]
    output.SetText("%d"%(_obj._value))[/code:vvgcwmd3]
    And get the error message:
    [quote:vvgcwmd3]TypeError: %d format: a number is required, not NoneType
    
    from the last one "output.SetText("%d"%(_obj._value))".
    It seems I can not attach new member to each instance.
    
    Another way, 
    [code:vvgcwmd3]objA._value = 10
    output.SetText("%d"%(objA._value))[/code:vvgcwmd3]
    It works. I can attach new member to objA (not objA[0]).
    
    What's different between "objA._value" and "objA[0]._value" in this case?
  • That's cool~ Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • But how to index objA[1], if there are many objA?

    System.CreateByName("objB", 1, 0, 0)
    SOL.objB.SetPositionToObject("objA[1]", "point")[/code:24de8rgx]
    It doesn't work.
    
    Thanks
  • My goal is to replace "Create Object at Image Point" ex:

    -> System: Create object objB on layer 1 at (0, 0) from objA 's image point "point"[/code:2ymszz8n]
    to python script. 
    
    I try to call 
    [code:2ymszz8n]System.CreateRelObjIP(objB, 1, 0, 0, objA, "point")[/code:2ymszz8n]
    But get error message
    [quote:2ymszz8n]Type Error:CreateRelObjIP() takes exactly 6 arguments (7 given)
    
    
    How to pass parameters to System.CreateRelObjIP()?
    
    My construct version:Construct class 1.2
    
    Edit:
     "System.Create()" may not work, too.
    
    Edit:
    I try 
    [code:2ymszz8n]System.CreateByName("objB", 1, 0, 0)
    SOL.objB.SetPositionToObject(objA, "point")[/code:2ymszz8n]
    and doesn't work.
    
    Test cap is here.
    [url=http://dl.dropbox.com/u/5779181/create_rel_image_point.zip]http://dl.dropbox.com/u/5779181/create_ ... _point.zip[/url]
  • I use Construct Classic (v1.2) on win7 32bit, and got the same result.

  • Thank you. I will be careful.

    It may make user(like me ) confuse if event setting is not match to character.

  • Sorry, I'm not sure what's wrong.

    I try built-in MouseKeyboard object.

    + MouseKeyboard: Key W is down
    -> Text: Set text to "w"
    + MouseKeyboard: Key S is down
    -> Text: Set text to "s"[/code:2sbg9go7]
    [url=http://dl.dropbox.com/u/5779181/keymap_err.zip]http://dl.dropbox.com/u/5779181/keymap_err.zip[/url]
    
    It's correct to perform pressing "w" & "s" key. 
    What's different between InputSystem and MouseKeyboard? (They look like using US layout, too.)
    
    Thanks.
  • Hi,

    There is a bug about key-map in configure of event.

    See this cap file.

    http://dl.dropbox.com/u/5779181/keymap_err.zip

    + InputSystem: Key W is down
    -> Text: Set text to "w"
    + InputSystem: Key S is down
    -> Text: Set text to "s"[/code:1v8ho4xv]
    
    key "W" and key "S" are mapping to key "Q" and key "A". Press "Q" will trigger -> Text: Set text to "w"
  • Hi,

    I test "System - Is overlaping (advance)" for multi-pair overlaping. (#4)

    http://dl.dropbox.com/u/5779181/collisi ... _test2.zip

    Unfortunately, it can detect "one" pair only.

    There is an interesting way to get UID of overlaping objects.

    In #5 & #6,

    + Blue: Blue overlaps Green
    + System: For each Green
    -> output: Add 1 to 'hitCnt'
    -> output: Append text output.Value('hitCnt') & " : ( " & Blue.UID & " , " & Green.UID & " )" &newline
    [/code:1s4ffk1g]
    
    I put the same object into family "Blue" and "Green"(family trick   ).
  • Thank you.

    Method 2 (add a detector sprite) looks better for detecting multi-pairs. (I'm not sure because of Family Trick.)

    Hope there is a more directly way of the advance version.

  • I got the same crash in Win7.

  • Method 2 is a good solution , Thanks.

    But I still has some questions,

    1. about collision detecting of Ball behavior

    [quote:2f52r2sy]it's not triggering a collision consistently is that the Ball Behavior is performing it's own collision check and bouncing the balls away from each other before the sprites

    I can use sprite's "On collision between" event, like that

    + ball: On collision between ball and ball
    -> output: Add 1 to 'hitCnt'
    -> output: Append text output.Value('hitCnt') & " : ( " & ball.UID & " , " & ball.UID & " ) " & newline[/code:2f52r2sy]
    It's work (but not enought for my goal). Ball's collision can be detected in this case.
    
    2. how to get second object(objectB) in "is Overlapping (advance)" 
    [code:2f52r2sy]+ System: Green (Pick) and Blue (Pick) are overlapping[/code:2f52r2sy]
    In "is Overlapping (advance)", it can pick two object( objectA= Green, objectB = Blue). 
    I can't identify objectA and objectB in action if I use the same object in event like that
    [code:2f52r2sy]+ System: ball (Pick) and ball (Pick) are overlapping[/code:2f52r2sy]( objectA= ball, objectB = ball)
    
    Here is my test cap file
    [url=http://dl.dropbox.com/u/5779181/collision_pair.zip]http://dl.dropbox.com/u/5779181/collision_pair.zip[/url]
  • My goal is to get UID of collision objects (pair).

    I found that there are two system condition "On collision(advance)" and "On overlap(advance)" can pick two objects.

    I tried "On collision(advance)" but didn't work. "On overlap(advance)" can get object pair sometimes.

    Here is my test file.

    http://dl.dropbox.com/u/5779181/collision_pair.zip

    Thanks.

  • Use python to parse text file is a good solution.

    There is a built-in INI object, so I try it first. Methods in INI object almost can be used in python, except for ForEachItem().

    Finally, I mix python script and built-in event to solve it, but it is not perfect.

    (run python script first)

    keys = [][/code:3rqwfxc2]
    (then built-in event)
    [code:3rqwfxc2]+ INI: For each item in group "group"
    -> System: Run Script ("keys.append(INI.CurrentItem)")[/code:3rqwfxc2]
    
    --
    Another question, how to call sprite's 'destroy' method in python script?