Game problem. Can't find the solution

0 favourites
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • You may have seen something similar in previous posts. I have brought aspects of the game to the forum a few times but i'm struggling a lot on this one issue that i can not seem to solve, even with the suggestions people have offered.

    Basically I have a game where a square has a different colour on each side of the square. The square then rotates to the oncoming enemies to match up the colour of the side with the colour of the enemy......simple.

    The problem i'm having is only after exporting the project. On the computer everything runs smoothly but after exporting the project through android(into intel xdk) or through cocoonJS the results are the same. The problem is...........

    when the enemy collides with the same colour side, it gets destroyed. When it gets destroyed it freezes for a split second, making the game look very un-smooth because of it.

    If you have any idea why this might be happening i can always send over a image of the capx to try and help. I should note the following in case it is relevant

    • all the images are small size so that can't be much of an issue
    • i've exported using intel xdk and cocoonjs, which both had the same issue (cocoonJS was slightly better).
    • when the enemy collides 4 events happen

    (1) A noise i made

    (2) 1 is added to the score

    (3) enemy destroyed

    (4) Sub event > "is animation playing" > "enemy 1"

    • enemy speed increases every 1 seconds

    just to show that not a whole great deal happens when the enemy gets destroyed so it isn't processing excessive amounts

    Thank you so much!!!!!!!!!!!

  • Was sub event placed after enemy destroyed? If that true then it is not the correct way to code.

  • alextro is this incorrect

  • Uh I don't know what you want to do with local/web-storage as a condition to play a sound fx.

    Would be better if score occur after those Ninja destroyed (Ninja on destroyed >> add 1 to score). With your current condition the score will not store the value correctly especially when more Ninjas collide with a "color" box at the same time. Trust me I made some test!

    So you can safely placing sound fx & score after 'Ninja on destroyed'. But make sure set text to score after add 1 to score, or simply separate the text action under 'every tick' condition.

  • After fixing this issue, you can turn these 2 event in one. Simply making the Green and Blue into one object, and adding two animations: "Green and Blue". Then, add an instance variable called "Color" (as example). In each object, you can write her own variable (Blue and Green). Then, in the event "On start of layout", add an action "Set animation to [OBJECT].Color (the instance variable) " Then, on start of layout, the object will appear of the color that you've choose. And, add one OR block with these conditions "On collision with [OBJECT]". Above this event, you can "pin" the condition: "Is animation [OBJECT].Color is playing". Simple to have these 2 events into one!

  • alextro The reason i have the local web storage for the sound is because i have a mute button so that when the game is closed down and re-opened, the volume will not reset.

    I'm a bit confused on how you're saying I should re code it?? To drag the 3 events on the right down to the sub event(is animation playing)?

    Its currently an array so the enemies are from one sprite with 4 different animations (see image below)

    The name of the sprite should be "ninjas" so don't be put off by it saying blue

  • This is what I'm trying to say:

  • alextro thanks so much. I will try it out this weekend and get back to you!

  • Very better, alextro !

  • alextro Hi I did exactly what you said and it still seems to be jumpy. If it's not when the object is destroyed what could it be? When it's created?

  • alextro could it be that the enemy is speeding up every second?

  • Please upload your capx and share it, so it is possible to take a look..

  • zikdot

    Shouldn't be a problem, once destroyed system will add a value to the score. Might be it would be something with collision event. To anticipate speedy object doesn't detected collide with other object, I usually use overlap test:

    Sprite1 is overlap Sprite2, Trigger once >> Destroy Sprite1

    Put 'Trigger once' after 'overlap'.

  • LittleStain I just sent you a dropbox link with the capx in over a PM. Not sure if you received it because its showing in my outbox

    alextro I'll have a go at that thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The problem could be the checking of the webstorage value on every collision..

    It is completely unnescessary to do so if you set a variable to the webstorage value..

    And even that seems unnescessary for you are checking the same webstorage every tick and setting a sprite visible accordingly..

    Checking it every tick is also not nescessary..

    Also wondering why you'd use webstorage for this instead of a global variable..

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