LittleStain's Forum Posts

  • You could use lerp (linear interpolation) for this, but you could also program it yourself

    Create a global variable speed

    on right arrow down - sprite set x to sprite.x+speed

    add a subevent

    system compare variable speed is less than 10 - add 1 to speed

    on left arrow down - sprite set x to sprite.x+speed

    add a subevent

    system compare variable speed is more than -10 - subtract 1 from speed

    X on right arrow down (so inverted statement)

    X on left arrow down (so inverted stament)

    subevent

    system speed is between -10 and -1 - add 1 to speed

    system speed is between 1 and 10 - subtract 1 from speed

  • To get the distance from the enemy to the player use this:

    distance(enemy.x,enemy.y,player.x,player.y)

    if you want to know if this distance is less than 100 pixels use:

    system compare two values: distance(enemy.x,enemy.y,player.x,player.y) < 100

    the distance is measured in every direction so 100 is like a circle around player.x,player.y with a radius of 100px

  • While working on an example I got this one..

    Although it's not exactly what you asked for, it has possibilities..

  • If you really want to use HTML elements, there is a plugin for that in the plugin section of this forum.

    If you want to recreate something like that in construct code, it's possible but not easy..

    It would mean creating a scrollbar based on the size of the visible text, using masking to mask the part unvisible, etcetera..

    An easier choice might be working with a next and previous button to go to other parts in your text instead of scrolling..

  • Give the player Timer behaviour..

    Set the timer for a random period

    on timer end make powerup available..

    To learn more about the timer behaviour, please refer to the manual..

  • enemy now has both pathfinding and bullet behaviour..

    I don't think that is advisable..

    Please decide on how you'd like your enemy to move..

    Also I guess using pathfinding both on the player and the enemy (the enemy refreshing every 0.1 second) might not be a good move performance-wise, but you'll have to check in the debugger for that..

  • Just from my head, so there could be some unclear stuff:

    Add a global variable TotalScore

    On start of layout 1

    if local key "Total" exists set Totalscore to int(Total)

    if local key "cash" exists add int(cash) to total score

    • set text to total score

    if local key cash does not exist

    • set text to no score

    on going to next layout save totalscore to webstorage local key "Total"

    Remember to reset global variable currentscore to 0 if you want to start over on the next layout..

  • This also depends a lot on the freedom of movement of your enemies, If they are restricted to a motion on one axis, you could change there movement speed on overlap at offset for a few moments and then return them to their normal speed..

    This will offcourse only work if the enemies are moving in the same direction..

    If they are still overlapping after a certain amount of time you could choose to change the direction anyway..

    Easiest way to achieve any of this is to have a family with just the one enemy and check the families overlap with the enemy, I thought that way you can actually reference both instances..

    For families you need the paid version though..

  • you probably want to know if the player's moving angle is between certain agles to switch animations, so this is how:

    first set rotate off in the pathfinding properties.

    (YourSpriteName) pathfinding is moving along path

    System is between: (YourSpriteName).pathfinding.movingangle -between- 22.5 -And- 67.5

    • set animation to down-right

    (YourSpriteName) pathfinding is moving along path

    System is between: (YourSpriteName).pathfinding.movingangle -between- 67.5 -And- 112.5

    • set animation to down

    etcetera..

  • for each enemy

    system compare two values: distance(enemy.x,enemy.y,player.x,player.y) => 100

    enemy - move towards player.x,player.y

    for the second part I would have a rotating sprite at the players position and pin the enemy to it (trigger once), when distance is less then 100, but there are probably better solutions..

  • You can get the moving-angle of your sprite with the expression

    Sprite.Pathfinding.MovingAngle

  • which method (behaviour) are you using for the movement?

  • As far as I know, to prevent weird and unexpected effects it's still:

    "Never use physics in combination with other behaviours"

  • Are you by any change having the map be created every tick instead of once?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • test if any enemies are left on screen using the .count

    system compare two values: familyenemies.count=0

    but you should only do this in level two, only trigger it once and only have it active after enemies have been created..

    so please let the program know on what level it is by using a global variable level and please put all the events for level 1, level 2 etcetara in their own group and only activate it when that level is playing..