ramones's Forum Posts

  • No the event does run because the second condition is true. The problem is with object picking.

    In C2 each event has a selected object list (SOL) that contains all the objects that the actions should act on (AKA the picked objects). The conditions filter that list. If you have an event:

    System: Every tick 
        -> Sprite: Set visible
    

    it will set all Sprites visible because all the Sprite objects are in the SOL by default.

    If you have a condition that references Sprite objects eg.

    Mouse: Cursor is over Sprite 
        -> Sprite: Set visible
    

    That condition filters the SOL to only contain Sprites that are under the mouse.

    So the action (Sprite: Set visible) only applies to those Sprites.

    In an OR block, the actions will run if any condition is true BUT the SOL is filtered by all of the conditions. So your event runs when Light_Switch = 1 but your Downlight_1 object isn't picked (because of the first condition) and so it doesn't get set visible.

    I hope that makes sense.

  • It's working as intended actually according to this:

    http://www.scirra.com/FORUM/r91-or-block-and-picking_topic52579_post330550.html#330550

    The 'mouse cursor over downlight_1' condition being false means that no downlight_1's are picked. You could have it like this:

    <img src="https://dl.dropbox.com/u/8367729/construct/pics/orPicking.png" border="0">

  • Try the Preferences -> Reset Dialogs button.

    https://www.scirra.com/manual/61/preferences

  • When you touch soundgreen:

    Event 1 - are you touching soundgreen? - yes - swap them

    Event 2 - are you touching soundred? - yes (you are now) - swap them back

    End result is nothing changes.

    'System: Wait 0 seconds' will postpone the following actions until the end of the event sheet so soundred won't get swapped in before the check for touch on soundred.

    <img src="https://dl.dropbox.com/u/8367729/construct/pics/toggleButton.png" border="0" />

  • Yeah you could use CanvasToLayer. If your canvas size is 640x480 and you want to spawn an object in the middle at 320,240 then you need to convert that canvas position to a layer position. So the position on layer 0 would be:

    CanvasToLayerX(0, 320, 240), CanvasToLayerY(0, 320, 240)

    or in general:

    CanvasToLayerX(0, WindowWidth/2, WindowHeight/2),

    CanvasToLayerY(0, WindowWidth/2, WindowHeight/2)

  • You can use these expression:

    ViewportLeft(layer)

    ViewportRight(layer)

    ViewportTop(layer)

    ViewportBottom(layer)

    ViewportLeft(0) = the left edge of the screen (layer 0)

    Screen width = ViewportRight(0) - ViewportLeft(0)

    Centre X = ViewportLeft(0) + (ViewportRight(0) - ViewportLeft(0)) / 2

    Centre Y = ViewportTop(0) + (ViewportBottom(0) - ViewportTop(0)) / 2

    200 px from the top of the screen = ViewportTop(0) + 200

    etc...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use the tokenAt(text, index, seperator) expression to split up strings.

    tokenAt("SetLives 10", 0, " ") = "SetLives"

    and

    tokenAt("SetLives 10", 1, " ") = "10"

    So:

    if tokenAt(input.Text, 0, " ") = "SetLives"

    then set lives to int(tokenAt(input.Text, 1, " "))

  • DiabloMovement2.capx (r111)

    I split the movement into separate horizontal and vertical movements so if it gets blocked horizontally it can still move vertically and vice versa.

  • Zero is already in the array (it's all zeroes at the start) so you can only add 51 values (1-51). It keeps looping trying to add 52 values which isn't possible = infinite loop = freeze.

    You could set all array values to -1 first.

    (or you could use values 1-52 instead of 0-51)

    <img src="https://dl.dropbox.com/u/8367729/construct/pics/cardarray.png" border="0" />

  • In an empty array all the values are 0. If your random number is 0 it won't be used because it already exists in the array so you don't have any card where CARD_ID_ORIGINAL = 0.

    And you should 'set value at n to Random_Number', not 'set value at n-1' otherwise the first value will be at -1 and you end up with a duplicate.

  • Mouse - On left button clicked on 'tiles'

    System - tiles.Layername is visible

    It's probably just checking the visibility of the first layer. Try a 'for each tiles' in between those two conditions.

  • Event 9 you set 'red' towards 'enemy'. Which enemy though? You haven't specified so they'll all just move towards the first in the list. You need associate each 'red' with a specific enemy.

    Give 'red' a number instance variable called 'targetUID'.

    When you spawn the 'red', set it's 'targetUID' to 'enemy.UID'

    and then in event 9 instead of every tick have

    system: for each red

    enemy: pick by UID red.targetUID

    ---> red: set angle toward (enemy.x, enemy.y)

  • One way you could do it instead of using those entrypoint sprites, set the player to the door position and then move him forward a bit so he's not overlapping it.

    layoutDoors.capx

  • You can download the latest version: https://www.scirra.com/construct2/releases/r111. Even if you prefer to use stable it's handy to have the beta installed as well for checking other people's examples.