[Solved] Improving and Optimizing Code

0 favourites
  • 3 posts
From the Asset Store
Two levels with two sistem Wave. with Source-code (.c3p) + HTML5 Exported.
  • Hello, Dcrew here! I have this:

    <img src="http://screensnapr.com/e/rYDT1i.png" border="0" />

    The code makes it so that if the player is under a tree then the tree is half visible (50 opacity).. and if not then the tree is fully visible. Now as you see in that code I use a for each loop. and wondered if there was a way that uses less memory. it's not bad (it runs fine) but I'm guessing with my code that I used if I had like 50+ tree's then it would get laggy.. Is there another ray of hope? Or will an update make a better way?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Player overlapping tree = opacity 50

    Player overlaping tree [negated] = opacity 100


  • Player overlapping tree = opacity 50

    Player not overlapping tree = opacity 100

    Yes, How is that humanly possibly difficult to understand? -.-

    Edit: Oh I realise your suggesting code, I don't know if that would work because wouldn't you need to check each tree object with a For Each?

    Edit 2: I'm a fruit!! It worked:

    <img src="http://screensnapr.com/e/xCEjeZ.png" border="0" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)