Jimzip's Recent Forum Activity

  • Hey all. Just an update: I've been working on this, and with your advice Plinkie I ended up breaking all the functions into chunks, each new step triggered by instance timers, rather than 'System: Wait X Seconds'.

    So far, things seem to be working flawlessly now. :) I could debatably also replace some functions with 'Current_State = Patrolling > Trigger Once' but I don't see the harm in using functions instead.

    I realised that the function was also breaking (where enemies were becoming 'stuck' in their waiting position) because they were overlapping a trigger object that tells them to stop. So the last couple of lines of code 'bump' the enemies off these triggers if they're overlapping when it's time to patrol again.

    Thank you so much for all the help Plinkie!

    thanks! It's been in dev for a couple of years and I've really given my pixelling skills a workout in that time haha. You can follow my progress on twitter Jimzip No timeline for release yet but it's coming along pretty swiftly the last month or so. ;)

    Jimzip :D

  • Ok, yeah I see what you're saying. This is old code & much of it is redundant, I'll have a play around and see if I can get it working outside a function.

    Thanks a heap for your help! I'll post any solutions I find.

    Jimzip :D

  • Sorry, I'm not sure I understand.

    After setting a timer, I have to signal when it's finished. When the signal is received, the function carries on.

    BUT ...

    The signal can only be sent outside the function ('On Timer Finished' is its own trigger) ... so I have to trigger it like I did in that screenshot. Or is there something I'm missing?

    Jimzip :D

  • Hey Plinkie, thanks for the quick reply. I did try timers, but thought it wouldn't work because it was leaving the function to trigger the 'on timer' event outside.

    But it seems to be working ... kind of.

    Here's what I have now:

    The problem now is, I assumed timers are set per-instance so I don't have to worry that it's outside the function ... but if I pause the game while more than one enemy is waiting, they all seem to sync up, implying that the signal is not per-instance, but is being received by all of the waiting instances. Is there a way to fix that?

    You can see what I mean here:

    http://tiny.cc/azhi2y

    I tried passing the enemy_sprite_pin.UID in the timer: "Wait_Finished"&Enemy_Sprite_Pin.UID - and signalling the same thing back. But it didn't seem to work.

    Any thoughts?

    Jimzip :D

  • Hi all, this has been asked before but after reading a few of the posts

    (https://www.construct.net/en/forum/construct-2/how-do-i-18/wait-and-timescale-issues-57207 for example), I still can't get to a solution...

    Basically, I have enemies that patrol. They get to the end of their patrol route, then pause, then go back to the start, then pause, etc. etc.

    The problem is, I have game menus which stop all moving objects, including enemies. Their timescales get set to 0. But because the enemies are running functions with waits (eg. "Wait 0.5 seconds"), they continue to perform actions in the background, and when I return to the game from a menu, their behaviours are totally wacked. Note; I am not turning the general Time Scale to 0, because a lot of other things need to keep running. This would make things easier, but I would need to rewrite a LOT of code.

    Here's the code in question:

    So, what I need is a way to wait in the function - whether or not the object's time scale is 0, then continue the function when the game is unpaused or whatnot. I read about using a variable and subtracting based on dt, but the solution didn't seem like it worked. I tried signalling based on whether menus were open, but I couldn't get the function to recognise it. I also tried creating a variable which gets added to while the menus are closed, but not when open, so I could reference that within the function, but I am ... not a super mathy guy, and I'm having trouble with this.

    Any help would be muchly appreciated. :)

    EDIT: I forgot to highlight the third wait in that image (this wait is based on an enemy instance variable).

    Jimzip :D

  • You do not have permission to view this post

  • The layers aren't global but the objects are. A bunch of objects in the Moving Objects family placed in the level are set to global with the tickbox, especially obj_docks_objects_01. That's also why cutting the code down won't have an effect, you need to uncheck the global setting in object properties as the problem is with the objects.

    it was so relieving to wake up to your reply this morning. ^^ Thank you very much! Glad it was something simple!

    Until now I didn't realise objects could also be global ... Very cool!

    Fixed, aaaaand moving on!

    Jimzip :D

  • Hi all!

    So I'm having a bizarre issue, and I've been scratching my head over it for two days now.

    Problem:

    Switching between certain layouts seems to bring sprites from the previous layout into the new one.

    Here's a quick video showing the objects piling up when switching back and forth (sorry the levels look so similar, I just want to fix this before making new ones!). You can see the layout name and the object count in the top left, and as I switch between them the objects increase. Level_02 starts with 375, for example, and ends with 751.

    dropbox.com/s/ld4m17a5k6n9w7h/objects-duplicating.mp4

    What I've tried:

    • Checked if layers are global. Nope.

    • Turned on and off each block of code and re-tested. Deleted most of the code. Nada.

    • Created a new layout from scratch (instead of simply duplicating the first one). Problem still exists, but read on ...

    Steps to reproduce / Leads:

    Weirdly, if I start the game on Level_01_Docks, then switch to others, I get the bug / duplication. If, however, I start the game on Level_02, or Level_03, and switch between them, it's fine. Going from either of them BACK to Level_01_Docks triggers the bug again. So I figure it's something to do with the layout Level_01_Docks, but for the life of me, I can't figure out what it is. The layouts Level_02 and Level_03 were created from scratch, as duplicating Level_01_Docks and renaming it still triggered the bug if you switch to it, no matter what the name is.

    I've never had this happen before and it's driving me a little nuts. I've stripped the project back to just 158 lines of code. Here's my project file on DB:

    dropbox.com/s/g5mlvz8gtscc0a1/pirate_planks-006-07_PROBLEMS.c3p

    You can switch back and forth between layouts by holding CTRL and pressing "," (previous) or "." (next).

    If anyone could take a look at this for me, it would be greatly, muchly appreciated! I assume it's something simple and stupid I've overlooked, but I've had my face to the monitor for too long and my eyes are becoming big pixels. []_[]

    Jimzip :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh! I never thought to check for an expression for this. I learn something new about Construct every day. Thanks ! That gets rid of a lot of unnecessary code.

    I actually finally figured out what the problem was however: The variable can't be 0 on start of layout. I had to make it 1, and now it seems to work. -.-

    Oddly, when I checked the variable through the debug mode, I could see it was bigger than 0, but the action still wouldn't work. Changing the variable to 1 in the event sheet and testing again, and voila. No problemo.

    I realised that I was calculating this wrong anyway though. X)

    Jimzip

  • Hmm. On closer look it appears there's a problem with the variable "Crab_Count". Though I don't know what it could be.

    On start of layout (or on creation of a dark crab enemy) a value of 1 is added to "Crab_Count", but when I try to use that in the "every x seconds" action it breaks. I just tested again with normal division (every choose(2,3)/2 seconds) and it worked.

    But that's a problem as I need the function to fire evenly no matter how many instances there are on screen - as in, the wait to trigger the function should scale with the number of crabs.

    Anyone got any ideas what might be wrong with the variable? Are you unable to use variables in this way?

    Jimzip

  • Hi all. This seems simple enough:

    Every choose(2,3)/[number of enemy instances] seconds I want to pick a random instance of an enemy and run a function on it.

    It works perfectly when I don't divide by anything, but the second I add a "/" the function never fires. What's the dealio here? (The variable "Crab_Count" is the number of instances, by the by. Let's just say it's 3).

    Any help much appreciated.

    Jimzip

  • Ah. Cool!

    That's awesome. It's working like clockwork now. Thanks a heap for the help 99Instances2Go!

    Here's how it's looking now:

    Jimzip

Jimzip's avatar

Jimzip

Early Adopter

Member since 15 Jun, 2014

None one is following Jimzip yet!

Connect with Jimzip

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies