farflamex's Recent Forum Activity

  • Ah yeah, that's what I was thinking, set a variable and enact the spread afterwards. I think it's the only solution, thanks for the cap :)

  • I'll tell you in a sec if I can work out where version 115 is, I'm on 114 and the updates page only seems to have 114....

  • Couldn't think of a good description for this, but I imagine it comes up fairly often and there's a solution, but my brain isn't working today and I'm not sure what to search for in the forums.

    I have a situation where I need to check through a bunch of tiles, and if they meet a certain condition, they spread that condition to neighbouring tiles.

    So I'm doing....

    Tile > Has condition.

    Neighbouring tile > Apply condition.

    The problem is that once I need to do this in a single pass, so that ALL tiles in the initial pick will spread the condition (but not the new ones). So when I find the neighbouring tile, I lose my list of picked objects from the above event - it just reduces it down to the single tile. So that puts an end to the event.

    As I say, I'm sure there's a better way of doing this, but what I basically need to do is to retain my list of picked objects from the top event while still somehow picking a single object of that type in the subevent.

  • I did remove 400 text objects and saw no change, so I thought as much. Thanks Ashley.

  • I've read through the performance tips and other posts on optimising, but I'm not sure about 1 thing.

    My game is running fine at 60fps, but it's jerky on Firefox (I hear this may be a FF issue rather than my game) and runs below 40fps on an older PC (with no graphics card, so perhaps this isn't a surprise). However, I decided to do some optimising and I have one question.

    My game had 1100 objects (I reduced this to 700), but now I need to add more. Most of these are text objects on seperate screens to the arcade screen (the only one which NEEDS to be running at 60fps, the others are static so fps isn't important).

    If I add extra objects which are off-screen and not even referenced by any events from the arcade screen, will they have any performance impact on the arcade screen? Is there any internal process in C2 which does checks or anything on objects which are basically inactive?

    I should point out that there's no way my game will run on mobiles, so the issue of memory probably isn't important.

  • Yeah, I guess my solution is messy anyway so a global variable can't be any worse.

    The wait action is the cleanest. Since I'm doing this on startup timing isn't important anyway. Is there any danger that this might be unstable though?

  • If anyone else comes across this problem and isn't sure where one event chain ends and another begins (I wasn't), it's basically an entirely new event. For example, in my example above, I couldn't even split this into 2 functions and do 'Call Function1', then 'Call Function2' below it because it's still part of the event chain, and the objects created in Function1 still weren't available.

    The only solution was to do 2 completely seperate 'On start of layout' events. So I've got 'On start of layout - Call Function1', then 'On start of layout - Call Function2' below it. The objects created in function1 are now avaiable to function2.

  • Ahh ok, that's exactly what's happening. I'm glad I checked because I've run through my code a hundred times now and tried various ways around it but you're right, sprite1 in this instance simply doesn't exist until I've completed the event chain.

    Right now I can't think of a better way to do this in my program but at least I know what's happening now and so I simply have to find an alternative. I don't like the idea of using 'Wait 0 seconds' because as you say, it sounds a bit unstable. I'll just have to find a way of seperating the functions.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I simplified it a bit, but in my case, I'm creating 4 large boxes and each has about 20 text objects which are pinned to the boxes - it's basically an information panel. They're all similar, but not the same, so I want to do it in functions rather than create every object seperately.

    Anyway, let's assume this is the best method, why isn't it working? Why does the first sprite not register when I jump to the 2nd function?

  • Ok badly written post, I'll try again.

    Function1 creates sprite1. It then calls function 2.

    Function2 creates sprite2 and pins it to sprite1. In order for function2 to be able to select sprite1, I pass sprite1's UID as a parameter. So when function2 is called, it attempts to select sprite1 from the passed UID, but it doesn't work.

    Even if I give sprite1 a variable and choose it directly in function2, it still doesn't work. It's as though sprite1 hasn't even been created at the moment I reach function2.

    Do I need to leave the first function in order for the newly created sprite to be recognised by further function?

  • Thanks, I'm not sure what I was thinking, clearly an array is the answer. It's funny, when I used to use arrays for everything (in the 'old' days) and then OOP appeared, I really hated not using arrays. Now I really hate arrays! I don't like having to remember which element contains which value, but in this case it's definitely the way forward. I like your idea of tokenising string data to simplify the storage, I might use that :)

  • I need to store quite a lot of data to detail star systems in my game (about 100 or 200 systems, with maybe 10 planets each). Off the top of my head, I want to store them as sprite objects (with no graphic obviously) with about 20 or 30 variables for each, but this sounds very wrong. An array would do the same trick I suppose, but it still sounds wrong to have 2000 arrays. Would this cause problems with memory or performance and if so, how would I be better off storing this amount of data?

farflamex's avatar

farflamex

Member since 7 Oct, 2012

Twitter
farflamex has 15 followers

Trophy Case

  • 12-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies