[SOLVED] Need help with my project, very specific though.

0 favourites
  • 6 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hey everyone,

    first of all, let me tell you that this is just a hobby project of mine. I continue to develop it in my free-time.

    I also started using C2 like two week ago, so my skills aren't that advanced and there is probably much much more to improve in my project than just that what my question concerns.

    But I don't expect you to correct all my nooby mistakes, should you feel obliged to do so though, I'd appreciate a PM.

    Let's get to my main concern, shall we.

    My project is a kind of weapon sandbox (.capx download further down), also serving as a playground for new addons and to advance my knowledge of C2.

    The feature which is the most important for my issue is the following:

    You can shoot grenades (bullet behaviour) which explode on colliding with the ground. You have the option to enable "Shell mortar". This childishly named option causes the grenade to spawn two small grenades to spawn when the initial grenade is at the height maximum of its flying arc.

    For checking whether the grenade is at its maximum, I created a function which compares the grenades current angle with its angle from the previous tick (stored in an instance variable). If the current angle is lower than the last known, the function returns a 1 and saves the grenades' UID in a global variable.

    This UID is then used to indentify the grenade which should spawn the two smaller ones.

    So far, so good. This works fine.

    As long as you don't fire multiple shells in a short time. Because when you do that, just some grenades trigger and spawn small grenades.

    This is my actual problem.

    I don't know what causes this issue, maybe the UID being stored in a global variable, but I see no other way of doing it.

    Anybody who is willing to read through some of my events can PM me or just reply here.

    Any help is appreciated.

    I now removed everything distracting from the project and removed any plugins used. I hope this won't cause any errors anymore for you.

    Since this is my first post, I apologize for anything being unclear, I will provide any info needed.

    Thanks so much in advance!

    Download .capx: (important sections are bookmarked)

    dropbox.com/s/3dpfzphgqnx6efv/GrenadeLauncherForumVersion.capx

    (Some additional info:

    I also have an option called bounce which causes a grenade to bounce once after colliding with the floor and exploding after the second impact.

    I noticed that if I enable both bounce and mortar rain options, some of the grenades which don't trigger, do trigger after having bounced and reaching their maximum height in the second arc.)

    [EDIT: As I said, I'm still learning, so there is most likely much to improve. Just try to ignore this. :)]

  • You probably wonder why no one is reacting. Well, there are two reason, i think.

    1/ The linked file is a backup file. Can be made a capx by just renaming it, but is it really the last version of your project ?

    2/ It leans on a bunch of plugins. It is a bit rude to expect me to dive in the forums, search & find all those plugins and install them. You should at least link to each plugin. Better, and nicer, is to isolate the problem in a new capx. You will get more and better responses.

    Nevertheless, when i have time later, i will make you an example. Starting from scratch. Plz, show me at least a picture of your layout. Is it top view ? Is it side view ?

  • Thanks for your response and thanks for clarifying what I did wrong.

    Sorry for the errors I made.

    I removed everything distracting from the project and deleted all used plugins from the project.

    I then exported the capx and included the new link in the edited post.

    The last time when the link redirected to a backup file, that was a Dropbox issue since C2 automatically creates backups, even for .capx.

    Thanks again for taking the time to help me solve my problem.

    (By the way, English is not my first language as you might notice)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I haven't seen your capx, but it sounds like simplest option would be rather storing uid as global, set a boolean or similar on the instance. Then you can identify all projectiles that meet the criteria by their instance variables. At the moment it sounds like subsequent grenades overwrite the uid of their predecessors, which are then lost.

  • Wrong? Did't want you to spell a lesson. Just wanted you to know why you had no responds, in a forum that is very alive.

    My English is way away from my moms language, an it is all self taught, it is for sure worse then yours.

    Never say sorry, you adapted to the best of your abilities, (as i try), they dont. But in here, i never seen one complain about bad English, lucky for me.

    For only using C2 for weeks, it is pretty nice. Just a bit to much 'If-Then'. I could not do all that in two weeks. And i sure have this particles still not under control as you do.

    Now, i think this is what you want to do :

    https://www.dropbox.com/s/xnjag04aisd0q ... .capx?dl=0

    I wrote comments in the capx, plz read them.

  • Thanks so much for taking the time and creating this (beautifully named) project for me.

    My first ever time I ask for help in this forum and I immediately get such a friendly response.

    This community is awesome.

    I read through the .capx you provided. I fixed my project now by changing the Angle check to the one that you proposed (Pick shell where int(Shell.Bullet.AngleOfMotion) > 0) which also allowed me to remove the now unnessecary UID instance variable.

    I also removed the CheckShellMovement function which isn't needed now anymore because I can just pick the needed shells.

    Thanks so much for taking the time to take care of my issue. If you have a problem at some point (maybe with particles), I will do my best do help you too.

    Also, thanks to DankP3 for proposing the global variable to be changed to an instance variable. Would probably have fixed my problem too.

    Now I have a compact and working new version of my project, thanks everyone.

    (Btw, 99Instances2Go, you said there are too many "If->Then" in my project? Could you tell me how I can improve this? Not in this thread, but via PM maybe? I don't have gained the power of writing PM's yet though. Maybe you could send me one quickly? Just if you have the time of course.)

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