playerelite's Recent Forum Activity

  • Hello,

    I'm working on a spacegame project and each ship animation has 32 frames.

    The problem is that I want to load them from a folder (System.AppPath + "/images/ship_1/" + frameId + ".png").

    I already tried to load the anim frame each time it's needed from the folder but it uses a lot of cpu :/

    So the question is, how can I load 32 frames once and then use them when I want (like if I created an animation on my sprite object with 32 frames)

    (ps: i'm using UniqueSprite plugin)

    Thanks in advance !

  • I've got the same problem as irbis now, when I destroy more than 5 unique sprite (even if there are 10 seconds between each destruction) it crashes :/

    My .cap if you want (right click to move, right click on rocks / gifts to destroy them) :

    http://rghost.net/private/59392717/6d86663ff667813572a8ac203f00e0d1
    [/code:3gtk4odm]
  • playerelite

    Re-download the link I posted for a hack fix. Ignore expressions a and b.

    Wow thanks, it's 100 % working now

  • Hello,

    I have a problem with the unbounded scrolling feature :

    I have an enemy moving with the RTS behavior (the circled one) and I'm the other sprite.

    When I get out of the layout (with unbounded scrolling), the enemy become invisible :/ it only happens when he is moving

    How to fix this please ?

    Thanks in advance, playerelite.

    EDIT : I restarted CC and it seems to be fixed ! Any idea of what might have cause this problem?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey, thanks for this plugin, btw I have a problem when I'm using it with python :

    When you use UniqueSprite.x or UniqueSprite.y it always return "0" :/

    # v = the unique sprite instance
    
    if MouseKeyboard.MouseButtonDown(0):
    	v.SetPosition(System.MouseX, System.MouseY)
           # so now v.x, v.y should be : System.MouseX, System.MouseY
    
    hp.SetText(str(v.x) + ":" + str(v.y)) # but the text is -> 0:0
    [/code:2ql6tlk4]
    Those things works when you use the default Sprite object (the construct's one) and return the Sprite current X and current Y.
    
    Any way to solve it ? 
    
    Thanks in advance
  • Thanks !

    Now I can call any object without losing it

    I'm creating something like a "game engine" (a customizable game would be a better word), I'm done with objects (picking, attributes) etc.. and now i'm working on events :

    is there any way to access Construct Events with python ? Or should I do like pygame :

    In construct  : On key "Q" pressed : run python : pyorbit.events.append("KeyPressed:Q")
    
    and then in my "loop.py" file :
    
    for event in pyorbit.events:
         do stuff
    
     [/code:1octdss7]
    
    Thanks a lot for all the help you provided to me !
  • I gave a look and I haven't seen anything that could cause this error :/

    I suppose that the game was working by the past, right?

    If yes, what have you done before the error appears ?

    Did you have 7 layouts by the past? (i've seen in your events "Go to layout 7") and your event sheet 3 name is Layout 7 events

  • If you drag an item to the "show inventory button" and then you drag another item, they both will be in 1 slot

    Cf :

    http://www.pixenli.com/images/1416/1416772224086237100.jpg[/code:2wom7wp5]
  • rghost.net / mediafire.com

  • This probably comes from your events, could you share your .cap file ?

  • Here's the gist of accessing objects and picked objects in python:

    documentation-for-span-class-posthilit-python-span-scripting_p622892?#p622892

    Behaviors are accessed like so. If the object is called Sprite and the behavior is Platform then the behavior is SpritePlatform from python. Be aware python is case sensitive.

    To access the behavior paired with the object you do it like so depending on the way you access Sprite.

    Sprite

    SpritePlatform

    Sprite

    SpritePlatform

    SOL.Sprite

    SOL.SpritePlatform

    SOL.Sprite

    SOL.SpritePlatform

    You can also see a list of them from python by setting some text to the dictionary with a snippet like this:

    Python("str(dir())")

    Also you can look at a list of methods available in a similar way:

    Python("str(dir(SpritePlatform))")

    Hey,

    Is Sprite[x] supposed to pick the "Sprite x" ?

    Because when I create for example 10 Sprite, if I do Sprite[0].SetX(1) and then Sprite[4].SetX(25) -> it's always the same Sprite object that moves :/

    EDIT : It looks like that if I create those sprite in the Construct Layout Editor (copy paste 5 time the sprite), the Sprite[x] thing is working BUT if I create those using python :

    System.CreateByName("Sprite", 1, 100, 100)
    [/code:2d8t12t0]
    
    then the Sprite[x] thing is giving me this error :
    [quote:2d8t12t0]
    ---------------------------
    Error
    ---------------------------
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\A\F\G\SRC\main.py", line 30, in <module>
        execfile("src/load_game.py")
      File "src/load_game.py", line 5, in <module>
        Sprite[1].SetX(10)
      File "<string>", line 911, in __getitem__
    IndexError
    
    ---------------------------
    OK   
    ---------------------------
    
    
    
    my python code is 
    [code:2d8t12t0]
    System.CreateByName("Sprite", 1, 500, 200)
    Sprite[1].SetX(10)
    [/code:2d8t12t0]
    
    There is 1 sprite instance created with the layout editor (Sprite[0]) and one with python (supposed to be Sprite[1])
    
    [h2][b]EDIT 2 :[/b][/h2] Sprite[x] seems to works only when ALL the code of "load_game.py" was executed, is there a way to access Sprite[x] before all the code was executed (except SOL.Sprite) ?
  • Hey !

    I found a way myself, I don't know if it's the best one but it's working !

    First, to import the class, do :

    Start of layout, python script :

    import sys, os, random
    
    class GNPC():
    	
       def __init__(self):
          # npcList
          self.npcList = []
          self.npcListMov = []
       def addNpc(self, npcObject, npcObjectRTS):
          self.npcList.append(npcObject)
          self.npcListMov.append(npcObjectRTS)
    
    npcManager = GNPC()
    [/code:22wogsv7]
    
    Then, when you spawn NPCs (for each npcs etc..) do : 
    [code:22wogsv7]
    npcManager.addNpc(SOL.entity, SOL.entityRTS)
    [/code:22wogsv7]
    
    Finally, to call event from your object : (for example : every X seconds -> for each object -> do this code)
    [code:22wogsv7]
    npcManager.npcList[0].SetValue("test", 500) # This is to call events from the object
    npcManager.npcListMov[0].MoveTo(random.randint(1,7000), random.randint(1,4000)) # This is to call events from the RTS Behavior (of the object)
    [/code:22wogsv7]
    
    [b]EDIT[/b] Btw, I don't know how to add python variables to objects in a list :/
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