playerelite's Recent Forum Activity

  • Hey, well I created a class for my objects but this I don't know how to add it to Construct :/

    I tried adding it in start of layout -> Python Script -> my class etc..

    With : execfile(path to my py file)

    but it doesn't work, so, how can I add a class to a Construct project :s ?

    Thanks in advance for your help !

    player.elite

  • Is there a way to create new private variables using python ? Or do I have to create a private variable called for example "parameters" and then split the content to create something like private variables ? (exemple : parameters -> "var1_value:var2_value" etc... and then to get value1, parameters.split(":") -> parameters[0]) ?

  • Wow ! Many thanks for this quick answer

    Also, thanks for the link, I did not know about the SOL.Sprite[X] : I always thought that picking an object was replacing the last one !

    Many thanks again

    player.elite

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey guys, can someone tell me how to access behaviors event with python please ?

    I mean, for example : Sprite.Behavior.RTS.MoveTo etc... ?

    Thanks in advance !

  • Ahahah :p

    Yeah, in an old project I had a lot of events and it was really buggy -> took 30 seconds to load the project (even if I have i5 3.4 GhZ processor, 8 Gb ram etc...) but now I use this way :

  • A good reason to use CC is that it's free and you can sell your game.

  • I think this was a problem in my code (maybe the fact my Sprite is called "object" ?). I recoded everything and now it works

  • Hey

    So I'm currently working on a game which is 95 % made with Python and I want to pick an object by comparison using python and the objectname.PickByCompare

    The problem is that it's not working :/

    myObject.PickByCompare(myObject.Value("name"), ==, "test")
    [/code:p3nvxps0]
    
    I think that I must do something like (for each object -> pick by comparison) but I don't know how to do this 
    
    Any idea  ?
  • Yes ofc :p

  • Well I'll give a look

    The reason I'm doing this in python is that because the game will be 99% editable, I want to let users mod what they want using python (editing txt python file then they are executed by construct)

    Edit : another reason is that with python I can have temp variables and with events I'd have to create useless global variables...

    Edit 2 : String addition is not the reason, if I replace all my script by anything in python (example : print "hello") it shows me the error message too...

  • Hello,

    I am currently working on a new project and I'm using python, the problem is that when I start the game, I have an error message and I don't have any idea of where it comes from.

    For the moment the game only have this code (and it works) :

    import os.path
    
    totalObjects = INI.ItemValue("objectsList", "objects")
    objects = 0
    line = 0
    lineObjects = 0
    
    while objects < totalObjects:
    	objects += 1
    	lineObjects += 1
    	if lineObjects > 5:
    		line += 1
    		lineObjects = 1
    	objx = (745 + ((lineObjects - 1)* 55))
    	objy = 105 + (line * 55)
    	System.CreateByName("object", 1, objx, objy)
    	SOL.object.SetValue("name", INI.ItemString("objectsList", objects))
    	if os.path.isfile(System.AppPath + "images/" + SOL.object.Value("name") + ".png"):
    		SOL.object.LoadFrameFromFile(System.AppPath + "images/" + SOL.object.Value("name") + ".png")
    	else:
    		SOL.object.LoadFrameFromFile(System.AppPath + "images/undefined.png")
    [/code:zdl4z7u6]
    
    But I get this when I start the game  (I click ok and then everything works fine, I mean, the code above do what he must do) :
    [code:zdl4z7u6]
    ---------------------------
    Error
    ---------------------------
    Traceback (most recent call last):
      File "<string>", line 1387, in <module>
    TypeError: Error when calling the metaclass bases
        __init__() takes exactly 1 argument (4 given)
    
    ---------------------------
    OK   
    ---------------------------
    [/code:zdl4z7u6]
    
    Has anyone an idea of how to fix this  ?
    
    Thanks in advance 
    Regards, player.elite
  • Well, thanks for your anwser

    I'll try with SpriteFont then, I tried the "outline" effect too but the line color can't be changed (white) and it's really ugly (pixelated).

    Edit : little problem, the SpriteFont's download link is broken

playerelite's avatar

playerelite

Member since 30 Sep, 2012

None one is following playerelite yet!

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies