mikehive's Forum Posts

  • Instance variables are what you need. Each enemy can have their own instance variables, in which you can store each one's health, attack randomiser, AI state, anything you want.

    https://www.scirra.com/manual/73/instance-variables

  • Yes. Make a variable called loopCounter (or whatever) and set up logic like this.

    Set loopCounter = number of berries to be added to stack (in this case 5)

    Set up a While loop:

    While loopCounter > 0:

    • sub event: if berry stack in inventory = 10, create a new stack of 1, -1 from loopCounter.
    • sub event: if berry stack in inventory is < 10, +1 to stack, -1 from loopCounter.

    The script should loop through until it runs out of berries to try to add to the stack. But do note that this is off the top of my head and hasn't been tested.

  • If I understand you correctly, that's what the period offset in the intital setup is for. Let's say you have a 4-second cycle. As you say, sines usually start from the center - your ABC analogy will go like this:

    B(0 seconds), C(1 second), B (2 seconds), A (3 seconds), back to B (completes the 4th second/back to 0)

    Therefore if you set the period offset to 3, you begin at A. Setting the offset to be exactly 75% (or three quarters) of the cycle duration will give the effect you want.

  • Hmm. On further testing it seems that I'm having a little problem with R0j0's collision system. For some reason it works perfectly well and smoothly when approaching diagonals from the side, but when colliding with something from above, my player sprite now judders uncontrollably. This doesn't happen to me in the original capx, just in my game. Any idea what might be causing this? Presumably it's something about my project that causes this, but I can't think what could possibly be a reason...?

  • Ah! That does work rather well. It was daunting to reproduce in my game, and I was thinking the whole time "this will never work", but it turned out that it did work quite well actually in the end!

    Thank you to you and R0J0hound! What a C2 wizard

  • Thanks for the link! However, I ran that capx three times and every time I managed to get the player sprite stuck in a wall almost immediately. It seems that it doesn't work very well?

  • Hi guys, I'm having a collision problem! My player sprite is moved with 8-Direction controls and I'd like my game to have a lot of diagonal walls (Solid behaviour). I'd like it if the player could 'slide along' the wall if you move up or down whilst pressing into it; it works fine to slide downwards along the wall, but if you attempt to slide UP the wall and press into it, the player collision object just stops dead. I realise this is a hard concept to describe, so I made a (very crap) illustration to help:

    And I have noooo idea how to get the upward diagonal motion I need. Does anybody have any ideas??

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey guys! My quirky, short little C2 game, Doodle Jamboree, came out on Steam this morning! It's only $2 and it was made with lots and lots of love <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    Play as a drawing and explore a world of paper scraps and doodles in an eccentric little art-venture!

    STEAM: http://store.steampowered.com/app/68736 ... _Jamboree/

    I did everything on the game myself - including art, design, music, and code - over a period of 8 months. Hopefully somebody out there will like it <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • You do not have permission to view this post

  • This is a vaguely worded question, but as a good general practice, try to identify events you might find yourself repeating a lot and see if you can make a Function out of them. Then, rather than writing the same code ten times, you can code it once and just call it ten times. More efficient

  • talk about rare product!

    Hey, thank you!

  • Haha no worries, we've all done it

  • Try losing the quotation marks in the parameter brackets - eg dictionary.Get(sprite.inst)

    Putting it in quotation marks will make it interpret that as a string

  • You're comparing each Enemy's Y coordinate to itself and only moving it to the layer top if it's greater than itself, which it never is.

    Also, your "Every Tick" is redundant; these events will trigger every tick regardless

  • I can't speak for everybody else but I'm not sure I understood the question Can you describe in more detail what you'd like to do?