Lumik's Forum Posts

  • OK. Now I understand it better.

    You should give instance variable 'picked' for block (not for your collision object). Then when mouse is clicked use overlap and pick random instance conditions to pick one of the blocks that are overlapping the collision object. Set variable 'picked' to true for picked 'block'.

    Then make two separate events:

    'Block' is 'picked' -> Set 'Block' position to mouse.x mouse.y

    Mouse On button released -> 'Block' Set 'picked' to false

    The basic idea is to pick one block when mouse is clicked. Keep moving it to mouse position as long as the 'picked' variable is true. And finally set 'picked' variable false for all blocks when mouse button is released.

    Instead picking random you can pick nearest if it works better for your game.

  • Try reversing the order of the two events.

  • You can use "Pick random instance" condition after overlap condition.

    Edit: Just realized this wouldn't work as this would pick new random instance every tick. You will need more comlicated set of events and conditions to pick only once.

    I'm not quite sure I understand what you are trying to do. Maybe it would be better to perform action when mouse button is clicked insteas of while pressed.

  • It seems this can give unwanted results in cases where prev2 < prev1. For example row 1,2,2 or 2,3,3 is possible.

    Also the initializing row "set prev1 to (rand-1)%4+1" always sets prev1 to rand.

  • Solution of tomsstudio seems clever. It propably works.

    Personally, I think the way "wait" action works makes it quite problematic to use if you don't exactly know how it works. I prefer making my own timers using instance variables like this:

    • Make instance variable ReactionTime for Enemy.
    • Condition: Every 0.1 seconds | Action: Enemy: Add 0.1 to ReactionTime.
    • Replace all "set line of sight range to 0" actions with Action: Enemy: Set ReactionTime to 0.
    • Add another condition to your first event: Enemy: ReactionTime > 1.0.
    • Remove your last event (it is now useless).
    • Remove wait action.

    I feel that in many cases variable based timers give better control over events than wait action or timer behavior.

  • Basic problem is that the condition "numEnemies = 20" is true on every tick, and boss is spawned every tick as long as numEnemies is 20. Many ways to solve this, and you can use any of these you like:

    • Add "Trigger once" condition to your event after numEnemies = 20 condition.
    • Add 1 to numEnemies after spawning the boss (then numEnemies is 21 and not 20).
    • Add new global variable "BossSpawned" with initial value 0. Add condition BossSpawned = 0 to your event. Set BossSpawned to 1 after spawning.
    • You can add second condition using "count" expression so that Boss is not spawned is there is more than 0 instances of boss. (I haven't used "count". So I'm not sure about this.)
  • Use system conditition "Compare two values". One of the values is distance between player and enemy e.g. distance(player.X, player.Y, Enemy.X, Enemy.Y), and other can be any value you choose.

  • First of all you should have platform behavior for enemies and "default control" set to No.

    Making enemy walk towards player:

    Compare player.X < Enemy.X : Enemy Simulate control Left

    Else: Enemy Simulate control Right

    For attacking on contact use "Is overlapping" or "On contact" condition.

    For shooting you propably should first compare distance(player.X, player.Y, Enemy.X, Enemy.Y) to some suitable value to see that enemy is not too far to shoot. If you want to shoot only in horizontal level compare abs(Player.Y - Enemy.Y) to some small value.

    For jumping maybe check that distance(player.X, player.Y, Enemy.X, Enemy.Y) is short enough and player.Y < Enemy.Y.

    Then you can use Simulate control Up action.

    But if you want anything decent out tomorrow and don't have an enemy AI worked out yet, you are propably some weeks behind the schedule anyway.

  • This is getting off topic, but one comment anyway. While I think the ideas presented here are good, I don't quite see why everyone rounds random numbers to integers when dealing with propabilities. I would simply go with random(0,1) and that can be compared to anything (e.g. <0.001 if I want one in a thousand propability).

    Maybe this has something to do with human psychology and intergers being easier to comprehend. I have been more involved with mathematics, and grown used to propabilities expressed as a number between 0 and 1.

  • Use "Contains value" condition for the array to check if the array contains powerup number.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • https://drive.google.com/file/d/0BzbX-wj9E7SrU0Q0bnl0cm1HTWs/view?usp=sharing

    Here is example. 3 slots and 8 power ups.

    There is only one power up sprite with 9 animation frames. Each animation frame number (except 0) is used as power up number (1 to 8), and selected numbers are stored in an array.

  • Sometimes they are on one side and sometimes not. That is random.

    You could try replacing "random(-200, 200)" with "choose(random(-200, -70), random(70, 200))"

    This will prevent getting platforms too close to previous platform.

  • Import as wav. Construct 2 will convert wav to ogg and aac.

  • https://drive.google.com/file/d/0BzbX-wj9E7SrVHRBVlh0bDJLR28/view?usp=sharing

    Here is capx. I hope this is what you were trying to do.

  • make global variable (e.g. var1) with initial value 0.

    Family On destroy : Add 1 to var1

    var1 >= 3 : Add 5 to timer & Set var1 to 0