How do I fix an issue with different responses to create?

  • Hey everyone! I have a set of events that create a Head object and Segments that follow way points. The interesting thing is that they fire perfectly when the Head is hand placed on the layout, but any time I try to create it using the system action it simply refuses to create the segments. It's starting to get very frustrating.

    Here is all of the code for the Spine enemy:

    And a video of the issue. As you can see, the first Head instance is hand placed on the layout and runs as intended. Every instance after that is created by System>Every 15 second> Create the head (which in turn is supposed to create the segments, etc.)

    https://youtu.be/pDV40-VpQrk

    Any ideas or help would be appreciated.

    I also ran into in issue where it says that certain instance variables are <varied> when there is only one instance of the object in question. (I even deleted it and received the warning that it was the only instance, then recreated it)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You dont see any amount of segments in the debugger ?

    Seems to me that fresh created segments are all on 1 place, following exactly the same path.

    In event 79, the head is unreferenced. The segments get the speed of the first head + 4. But that is not the problem. They all get created on the same place and get the same first waypoint.

    No idea why 80 is needed. They have a waypoint allready, just need a new one when there is a change.

    I have no idea whats more in event 80.

    I have no idea when you destroy the segments.

    Just rattling, never mind me.

  • lol Sorry, I just noticed that 80 wasn't opened in the shot. Yes, the destruction events are in there. Here are the contents:

    They should be destroyed when a certain distance off of the left of the screen is reached.

    Each segment should be spawned at the same y as the head with a 64 pixel (that's the segment_space variable) gap between origins on the x axis. I wondering if they are being spawned and just aren't headed on screen due to something going on with bullet instructions. I'll check the debugger for spawned events, thanks for the heads up.

  • They all get created on head.X + 64 , head.Y.

    If you want to create them with a space of 64, then keep the first creation. And change the head.X in segment.X in the other creataions.

    Since the create sets the segment picked, each next segment will pick the previous segment, and therefor spacing them.

    You see ?

    I think that you should bring the 'every ticks' in there resp. 'on overlap' and 'on collision events'. After you changed the target index.

    I still dont like the unreferenced state of the head expression in that event.

  • so it ignores the multiplications? The first is at x +64. The second at +64*2, etc...

    I've updated the waypoint change as you suggested. I completely agree.

  • There is no multiplication, wel i dont see it, try what i suggest ?

    I mean change the head.x TO segment.x (but with the right and full names, i am a lazy typer)

    But keep the first creation as it is !

  • A closer look at one of the events in 78. I understand that the way the text loops around may cause you to easily miss the multiplication normally. But you can see here that each iteration of segment increases the distance on the x that is multiplied by 1.

    The first is at +64. the second at +64*2, the third at +64*3, etc...

    I'll try what you suggested though.

    EDIT: After checking the debugger I see that they ARE spawning but WAY off to the right. I'm wondering if it's ignoring the order of operations and instead performing the addition before the multiplication. Thereby adding the head.x +64 THEN multiplying the resulting number instead of just multiplying the 64 and THEN adding that to head.x.

  • I missed that. Indeed. In my suggestion is no multiplication needed.

    And no, it should not ignore that.

  • The head creates at 64 pixels outside the layout. (width + 64, that is way on the right)

    4 + 4 * 2 is calculated as 4 + (4*2). You should use that last way to put it though.

    Do the waypoints move ?

  • Hmm. even changing them to reference one another and remove multiplication (as you suggested) they still spawn with an of >1500. :/

    And no, the waypoints are stationary.

    EDIT: Allright, seems we've sorted it. I changed the spawn point of the head to viewportright and viewportbottom instead of windowwidth and windowheight. I then had to change the speed of the segment to 254 as it referenced and unknown Spine_Head. Phew. Here's an image of the revised events. Thank you SO much for your help! It helped tremendously!

    and in action:

    https://youtu.be/A-w__06YnwA

  • Create the head at x= player.x + 30, where do they spawn then ?

    Where are the way points ?

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