Is coding in construct 2 consistant?

0 favourites
  • 5 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hi to the community! I would like to request help from the more experienced users in something that is troubling me in the past couple of days.as i am very new to this ,and i have just began to understand more and more i noticed something that really is ticking my nerves.i could swear that sometimes identical code does not do the things it used to do.what i mean is that it happened to me twice and although the events seemed perfectly logical and the same before i started messing around with them and when i reverted them back to the original it simply wouldnt do what it was supposed to do.after deleting them lines and putting them back in the excact same order,it worked.is it me and my lack of experience that causes me to miss little things or did you have the same experience as i have sometime during your project? Any ideas,suggestions or good practices for me to follow? I even saw a variable in debugging mode that just didnt change but the event worked! Should i start taking meds? <img src="smileys/smiley36.gif" border="0" align="middle" />

  • Yes, it's very consistent. Post examples of what code is on again off again and I'll try to give an explanation.

    Games are usually very dynamic so exact conditions are not often repeated.

    Here's a quick example of some events that may cause an issue given certain conditions.

    Bullet collides with enemy

    --- subtract 1 from enemy health

    --- destroy bullet

    Enemy health<=0

    --- destroy enemy

    --- add 1 to score

    With this one point is added per enemy hit. But depending on how many bullets are flying around you can have more than one enemy that has health less than or equal to zero. In those cases the enemies will be destroyed but you'll only get 1 point per group of dead enemies. This is not what we want instead we want a point per enemy.

    The fix is easy, just add a for each enemy to the second event.

    Enemy health<=0

    For each enemy

    --- destroy enemy

    --- add 1 to score

    Both ways are behaving exactly as written but the second one does what we want.

  • thank you for your reply. i fully understand what you are saying and with time and experience you know where and when to add things for your code to function properly and as intended. what am i saying though is something different.let me try to be more clear.

    Enemy health<=0

    For each enemy

    --- destroy enemy

    --- add 1 to score

    it works

    lets say i add (just for the example.it might not make sense )

    Enemy health<=0 and

    gamepad button a is down

            or

    Enemy health<=0 and

    gamepad button a is up

    For each enemy

    --- destroy enemy

    --- add 1 to score

    i try it,for some reason i dont like it,i go delete everything that i added ,i run the code and now for example enemy wont die if it meets the condition.

    i delete everything i write it down again and now it works.

    that kind of problem i am referring to .

    is there a possibility when you add complicated stuff like else,or etc start moving them around and when you delete them and revert to there previous state, the code in the background freaks out? i noticed that the bigger my project gets.is there a possibility my computer is slow and fails to read fast enough in some situations the code and hence the now it works now it doesn't situation? or maybe i change something and i cant see it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've never experienced such a thing. The event sheet is always run every frame.

    I suppose we could muse about possible situations, but it would help if you could give an exact situation.

    For me I have found events to be very solid and I've been able to do most anything I want to with as good of reliability as I'm able to design into it.

    As a final note, I've been using c2 since it first came out and if it had any on again off again issues with its core event system I'm sure I would have run into them and I would have most certainly reported them.

  • i have send you .capx in pm

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