ParanoidDev's Forum Posts

  • 2 posts
  • I didn't know events were faster than python, Thanks! Also thanks for the fix, can't believe I didn't see that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, I was making an event sheet that makes randomly generated rooms. It worked when it was event sheet but I thought It'd be a lot faster to work on using Python. I'm pretty new to using Python in Construct and I just can't see what's wrong with the code.

    Here's the code:

    ---

    import random
    
    if Sprite4.Value('StartCell') == 1:
         Temp = random.randrange(1, 4)
         if Sprite4.Value('Temp') == 1:
              Cell1.SpawnObject(WallUp, 6, 0)
              Cell1.SpawnObject(WallDown, 6, 0)
              Cell1.SpawnObject(WallLeft, 6, 0)
              Cell1.SpawnObject(DoorRight, 6, 0)
              Player.SetPositionToObject(Cell1, 0)
              Sprite4.Cell2 = 1
         if Sprite4.Value('Temp') == 2:
              Cell1.SpawnObject(WallUp, 6, 0)
              Cell1.SpawnObject(WallDown, 6, 0)
              Cell1.SpawnObject(WallLeft, 6, 0)
              Cell1.SpawnObject(DoorRight, 6, 0)
              Player.SetPositionToObject(Cell1, 0)
              Sprite4.Cell2 = 1
         if Sprite4.Value('Temp') == 3:
              Cell1.SpawnObject(WallUp, 6, 0)
              Cell1.SpawnObject(WallDown, 6, 0)
              Cell1.SpawnObject(WallLeft, 6, 0)
              Cell1.SpawnObject(WallRight, 6, 0)
              Player.SetPositionToObject(Cell1, 0)
              Sprite4.Cell5 = 1
         if Sprite4.Value('Temp') == 4:
              Cell1.SpawnObject(WallUp, 6, 0)
              Cell1.SpawnObject(WallDown, 6, 0)
              Cell1.SpawnObject(WallLeft, 6, 0)
              Cell1.SpawnObject(WallRight, 6, 0)
              Player.SetPositionToObject(Cell1, 0)
              Sprite4.Cell5 = 1
    

    ---

    I've set it so that StartCell is always 1.

    Here's a .cap in case the code doesn't make any sense:

    mediafire.com/download/lmxbczb7pyt01ym/VaniaLike.cap

    Also here's a .cap when it was still an event sheet, this is how it's supposed to work:

    mediafire.com/download/6zhelgghg6eqawm/SomeVaniaNew.cap

    Thanks in advance!

  • 2 posts