Solomon's Forum Posts

  • Hi, I am a graphic designer and an animator.

    I have been using Construct 2 for the past week or a bit less maybe. Very cool to say the least.

    Hopefully will have something to show in the near future! See you around

  • I think you need to post either a screen with your code or share the capx file, otherwise people don't see where the problem lies.

  • Set Global Variable: Invincible = 0

    After collision with enemy, set Invincible = 1

    Wait 3 seconds (or how many second you wish for your player to be invincible)

    Set Invincible = 0

    If invincible = 1 then do not make dmg to player (you need to get this into the part of the code where player takes dmg)

    --or--

    If you have the part where: player collides with enemy event, add another event: Invincible =0

    So it would be: if player collides with enemy and invincible =0 -----> player takes damage

    Or you could use true/false instead of 1/0.

  • Hi, I have been working in Construct 2 for the past week and its really great. I am intending to buy a personal license in the upcoming month to test out, what Ive done on mobile phones.

    I was wondering, if Construct 2 is capable of supporting 20 animated sprites (with a looping animation) at the same time on the screen, when exporting to a Samsung tablet or an Ipad, and still maintain a good FPS rate?

    I will get to test this out surely anyway and will report back, just trying to get some opinions and test out the waters.

    Now I know that it depends on the phone etc. but I was just curious overall. In the end I will cut down on the amount of sprites if I have to surely.

    I have been already reading about exporting options and I am psyched to soon see something I have done, run on my mobile platform

    Thanks and cheers.

  • Solomon - another way is to use a global variable:

    On Start of Layout B --> set NextSpawnTime = Time + 5

    then, instead of every 5 seconds:

    System Compare two values ( Time >= NextSpawnTime ) --> spawn box, and set NextSpawnTime = Time + 5

    The only thing to watch out for is if you pause the game (or open a settings menu, or display a message) - you would have to save the remaining wait time:

    TimeToSpawn = NextSpawnTime - Time

    then when you unpause, set NextSpawnTime = Time + TimeToSpawn

    OH WOW! Thanks a lot for your time! Now I have to wrap my head around it

    How much simpler would it be to have the ability just to toggle the "Every 5 seconds" condition to either start counting at beginning of game, or start counting at beginning of each layout?

    Construct 2 is great don't get me wrong, but it is seemingly simple things like this that just put me off for a bit once in a blue moon.

    Anyhow once I get this working by your example I'm sure this logic structure will come in handy in some other part of my game.

    Once again thanks for your time

  • shinkan

    I see... interesting.

    Basically, I want a box to spawn every 5 seconds after a layout is loaded.

    I have a title screen on 1 layout, during which I don't want anything to happen. I have it set that by clicking on it the player goes to another layout, which upon entering, after every 5 seconds a box is spawned.

    Edit: Only thing I cant set up is the part where the spawn timer starts only once the player enters the second layout.

    So basically:

    _____If Layout B is loaded

    ________Every 5 seconds spawn box

  • "Every X seconds" don't work as "per layout". It counts using the game time from the start.

    Oh wow... Really? Thats a bummer... any other simple condition to wait until a layout is loaded? Could you please share any other tips on how I can solve this matter?

    Thanks!

  • Solomon

    do the layouts share the same event sheet?

    there is an event "On Start of Layout"

    I had a similar issue that I thought might be some kind of bug, but turned out it was an error in my code. So, I would think there is something you are doing that is causing this - and it is impossible to say what it is without seeing your code.

    Hmm interesting... didn't know that layouts can share 1 event sheet. I am going to do some reading on this now.

    Sorry what I mean I cant find an "If Start of Layout" event or how to implement it as such.

    Thanks for the tips will do some more reading and if I dont manage to solve my problem will post a snippit of my code.

  • Create a global variable like Can_Sine. Use 0 for false and 1 for true.

    Create 2 conditions:

    Can_Sine = 1 > Box > Sine Active

    Can_Sine = 0 > Box > Sine InActive

    Box > On Collision with Object A > disable sine etc...

    Box > On Collision with Floor > Set Can_Sine = 0

    Thanks! Simple and elegant!

    I ended up making sure that the objects arent colliding with object B, only the floor instead, but this will come in handy. Still getting used to the mechanics.

  • Hi,

    I have a Main Title Screen Layout, and once clicked player goes to Layout 02.

    At the beginning of Layout 02 I have a condition: "Every 5 seconds" - spawn a box.

    Problem is, when I wait in the Main Title Screen Layout 5 seconds or more, and then click to go to Layout 02, the box is spawned already.

    So it seems that the timer - the "Every 5 seconds" condition is counting when the player is still in the Main Title Screen Layout

    How can this be? Am I doing it wrong? Is there another way to to make the "Every 5 seconds" condition work only after entering a layout?

    Thanks for the help.

    Edit: I tried to look for a condition: "On entering layout", but in the end couldn't find it.

  • "Thanks for your example, a lot to learn there" - mainly how not to do it ?

    Haha, nah

    Lot of nice mechanics going on there, always good to see something new to learn! So once again thanks!

  • Hi, I am having problems with sine behavior and object colliding. The object is not bouncing off an object upon collision but sliding down it because of the sine behavior.

    I thought of an alternative but I'm having problems implementing it in code:

    On collision with object A

    ......If not colliding with floor B

    ............disable sine

    ............wait 1 second

    ............enable sine

    ......Else

    ............disable sine

    ............do not enable sine after 1 second

    Basically if the box with sine behavior collides with object A, in order to override the sine behavior I am turning it off for 1 second and then turning it back on.

    But I'm having a problem, because when the object falls on the ground I want the sine behavior to stop, which works until the box hits object A then hits the floor straight after. This causes the sine to stop upon hitting object A, but then when it hits the floor it is already stopped, but after 1 second it turns on again.

    I'm not sure how to cancel the action of turning it on after 1 second after it hits the floor.

    Thanks for you help.

    Cheers.

  • rekjl - Ok I followed your example and know now what you did, thanks for your help

    RamPackWobble - Thanks for your example, a lot to learn there

  • Is this what you wanted to achieve?

    Wow, so basically it was all because of the "every random(0,4) seconds" that I was having both jitter problems on spawn and problems with spawning in the timeframe after destroying a box once they were all spawned? You switched the 'after random time frame' from event to action and killed 2 birds with 1 stone?

    Or did you do something else to prevent the box spawn jitter?

    I still dont get it why it cant be the way I did it the first time Could you please explain the difference?

    One more thing, did the collisions work alright (meaning were they pixel perfect without overlapping the ground) when the boxes hit the ground sprite? I read that there is a way to attach an invisible sprite to check for collisions, but why is that necessary, how come this simple code for collisions doesn't work?

    Thanks for all your help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To download the capx file please go to: filedropper.com/testtest

    7Soul

    Yes the first 4 boxes spawn correctly, the problem appears after I start destroying boxes after waiting a couple of seconds. So basically try this with the file that I have provided: Wait for 4 boxes to spawn. Wait 4 or more seconds after they are sitting on the ground. Click on a box to destroy it and watch another box spawn immediately instead during the 0-4 second period as is stated in code.

    Regarding the sine movement, if it really is buggy then I am a bit worried So basically it would be better to come up with a random movement and not use that behaviour eh?

    RamPackWobble

    Cant download the file unfortunately, missing file.

    rekjl

    I am attaching the capx file as you requested.

    So basically steps needed to recreate my problems:

    1) Watch as the boxes spawn from the spawner, keep destroying them randomly and watch them spawn. Some boxes will have a jittery movement on spawning other will not.

    2) Wait until the boxes are spawned randomly, all 4 of them. Then wait 4 seconds or more, and click on a box to destroy it, now watch a box appear instantly instead of in the 0-4 second time frame as Ive inputted in the event editor.

    3) There is also 1 more issue. Although I have set collision, the boxes, once they fall on the ground sprite overlap it. The only way to get rid of the sine and bullet behaviors on the boxes I came up with I have implemented, but still the boxes aren't pixel perfect so to speak with their collisions. Whats more, not only they aren't pixel perfect, but their overlap is not constant, some will fall more some less, which is weird as they all have the same speed when falling.

    I am getting a little bit fed up, I cant make a simple game without errors.

    Any help will be really appreciated.

    Thank you.