dop2000's Forum Posts

  • Did a little googling

    Time to decelerate to zero:

    time=(speed/deceleration)

    For example if current speed is 900 and deceleration 300px/s, then you need 3 seconds to stop the ship.

    Formula to calculate the distance:

    Distance=deceleration*(time^2)/2

    So to stop at target you need to start deceleration at distance 300*9/2=1350px

  • Did you set the value 0/1 with events? You were doing something wrong, because a code like this should definitely work:

     
    .... Spawn Enemy
         Enemy Set enemyType=1
         Enemy Set animation to "Snail"
    [/code:dhk0rxs7]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • See this post:

  • Are you assigning any value to that instance variable after you spawn a new instance of the sprite?

    You need to specifically assign the proper value, unless you want it to be default. I'm guessing your default value is 'slime'.

    Same applies to the animation.

  • TileMap object has a number of expressions to convert tile coordinates to screen coordinates and vice-versa.

    PositionToTileX(x)

    PositionToTileY(y)

    SnapX(x)

    SnapY(y)

    TileToPositionX(x)

    TileToPositionY(y)

    Use TileAt(x,y) to get tile ID.

    As for your second question, it depends on your game. If this is just for storing customizable properties for individual tiles, I would probably use an array or dictionary. If you need to add animations, behaviors etc. to your tiles, you will need to replace them with sprites. (or put sprites on top of them)

    I have an event set up so when I click the tilemap in an editor window (separate layer, paralax 0,0), but it selects tile id -1 instead of the tile I clicked on. I'm assuming it's not translating the mouse coordinates to the editor tilemap because of the parallax (the tilemap technically isn't moving)..

    Not sure I understand.. You may need to add scrollx, scrolly to your mouse coordinates. And probably subtract WindowWidth/2, WindowHeight/2. It's hard to tell without seeing your capx.

  • Use "Overlapping at offset" or compare distance(sprteA.x, spriteA.y, spriteB.x, spriteB.y) using "System->Compare two values"

  • You can try spawning two light sprites.

    One with "Destination out" blend mode to make a hole in dark layer. And one with something like additive blend mode or overlay effect on the background layer to add color.

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

    There may be a better way, but I couldn't find it.

  • Here is the method I know:

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

    Also, there is an example project in C2 - start a new project and select template "Multiple colored shadow casting lights"

  • In events where several object instances can be affected (like bullet collides with two enemies) I prefer to add another sub-event "For each Enemy". This often helps to prevent some weird and hard-to-detect bugs.

    Or if you need to make sure that each bullet should wound/kill only one instance of enemy, add "System->Pick random Enemy instance" as a sub-event.

  • Touch-> On any touch start :  SpawnPointSprite -> Spawn another object -> BulletSprite
                                  BulletSprite -> Set angle toward position-> (Touch.X  , Touch.Y)
    [/code:1r7sqxi1]
    
    Also make sure that you have "Set angle=Yes" in Bullet behavior properties.
  • "trigger once if true" should work, you are probably not using it properly.

    You can do this without the "areaclear" variable:

    Enemy-> Is boolean variable Dead set 
          System->Compare two values -> Enemy.pickedCound>=10  :  Go to next level
    [/code:yp3rty5g]
    
    First event will pick all dead enemies.
    Second sub-event will compare number of picked instances.
  • First issue - change your event to this:

    if Enemy has LineOfSight to player -> Set Enemy angle to Anglelerp(Enemy.Angle, angle(Enemy.X, Enemy.Y, Player.X,Player.Y), dt*4)

    Number "4" here is the speed of rotation.

    Second issue - after 1 second you can move your enemy to this position:

    MoveTo ->

    X=Player.X + choose(-1,1)*random(20,50)

    Y=Player.Y + choose(-1,1)*random(20,50)

    This will simply move the enemy to a random point around the player within 50px, but not closer than 20px.

    Or, if MoveTo behavior has "Move at angle" action, you can do something like this:

    Set dist=distance(Enemy.X, Enemy.Y, Player.X,Player.Y)*random(0.2,0.5)

    Move (dist) at Angle (angle(Enemy.X, Enemy.Y, Player.X,Player.Y) + choose(-1,1)*random(30,60))

    These formulas are just off top of my head, may not work very well.

  • Sure, just add a global variable JumpEnabled=0

    On Key pressed "Space" change this variable to 1

    Add a second condition to your "player > platform is on floor > player > Simulate platform pressing jump" event:

    System->Compare global variable-> JumpEnabled=1

    (to add another condition, select this event and press "C")

  • If you can't open the capx, rename it to .zip, unzip to an empty folder, open .caproj file in Notepad and edit this line:

        <saved-with-version>24700</saved-with-version>
    
    For example change to:
        <saved-with-version>24400</saved-with-version>
    [/code:1dq0e90q]
    
    Then open it normally in C2.
    
    To speed up objects in C2 you can use System->Set Object Time Scale. This will speed up (or slow down) everything related to this object - animation, timers etc.
  • NECRONOMICRON

    It's a completely different kind of game. The light ray is moving (growing) slowly and you need to place mirrors on its path. And all this in isometric projection.