dop2000's Forum Posts

  • Ashley

    Let's say I have a function "KillEnemy" which returns a value. Why can't I just call it if I don't care about the return value? Many programming languages allow this. In C3 I can only call it from an expression, so I need to do something like "set tempVar to Functions.KillEnemy", which is pretty inconvenient and makes the event sheet difficult to read.

    Tagged:

  • Of course it doesn't work - you didn't set array width to 0, you didn't insert new record to the end of the array, you didn't delete the last record when going back..

    See this fixed project:

    dropbox.com/s/l1le3x8zp3roth9/LayoutHistory.c3p

  • Recording a history is also not too difficult. Create an empty array with width=0. On end of any layout push a new record into the array with LayoutName.

    When you need to go back to previous layout, read last layout name from the array - Array.At(Array.width-1), then delete this index.

  • 619_RM You are welcome! You think we should charge people for downloads? :) You can always buy us a coffee!

  • Tilemap is already an array, you don't need to over-complicate things by adding another.

  • local variable tempX
    local variable tempY
    local variable tempFrame
    
    Set tempX to random(0,1000)
    Set tempY to random(0,500)
    
    // create first sprite
    System create Sprite at (tempX, tempY)
    Set tempFrame to random(Sprite.AnimationFrameCount)
    Sprite set frame to tempFrame
    
    // create second sprite
    System create Sprite at (tempX, tempY)
    Sprite set frame to tempFrame
    Sprite set Visibility = invisible
    
  • Great stuff, this can be very handy!

  • Your formula for lerp is a bit weird, you can change it to lerp(Self.X, Player.X + 2, dt) , it will work the same.

    As for the jittering, try adding "Player set x to round(self.x)" to event #4 "On stopped". I think it reduces the jittering.

  • Remove 8-direction, instead of comparing Beta and Gamma with zero, compare them with -20 and +20 ("less than -20", "greater than 20")

    This should improve the controls. But still the best solution is to determine which direction the phone is tilted most, and move the character in that direction.

  • Save layout name into the global variable in "On end of layout" event.

  • Can the Ai be done with bullet behavior or 8 dir as well for this?

    Yes, if you manually create a path through the maze for the enemy, for example with waypoint sprites.

    But if the maze is random, then you need pathfinding. If you wish, you can use pathfinding only to calculate the path, and then move enemies along this path with other behaviors - MoveTo or Bullet.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Im not using any tilemaps or grids for this. It's just solid walls, clearings and the player for the enemy to navigate through and chase.

    Ok, then your only option is Pathfinding. You just need to configure it correctly. If in your game the enemy goes through walls when moving along the path, it means that the cell size is too large.

  • With pathfinding it's all about correctly configuring it. You need to find the right cell size, cell border, speed, rotate speed etc. With correct values your character will navigate through the maze properly.

    If your game is grid-based, you can try EasyStarJS addon, it's an advanced and very fast pathfinding plugin for tilemaps, there is a link to C3 version on the last page:

    construct.net/en/forum/extending-construct-2/addons-29/behavior-easystar-js-pathfindi-96215

  • The problem here is that Beta and Gamma will almost never be 0. For example, if you are tilting your phone up, Gamma may be +90, but Beta may be +3. And Beta will "overpower" Gamma, because the event where you compare Beta>0 comes last. And the character will move to the right, instead of going up.

    Basically, you need to determine which direction the phone is tilted the most.

    Try setting "deadzone", ignore small numbers and only move the character when Beta/Gamma is smaller than -20 or greater than +20. You may need to experiment with these values.

    (By the way, on my phone Gamma is left/right and Beta is up/down, not sure why, maybe because I'm testing in portrait mode)

    Also, why did you add 8-direction? It may not work properly together with Bullet.

  • 10 layers is definitely not too many.

    Have you tried getting logcat log from the phone? There may be an error message which will tell you what's wrong.

    It would help if you could recreate this problem in a small demo project and post it here.