Juryiel's Recent Forum Activity

  • Maybe I'm misunderstanding, but won't this allow other stuff to happen unless I put all other code that isn't in this function under a condition that checks all of the units PVs and returns 0 for each.

    Instead I could have "Main Game Events" group and an "Animate Units" group and alternate between them which seems similar but easier to the above. I would also want each unit to complete its entire movement before another unit moves but i can probably keep track of that with some global or some such.

    Anyway thanks very much for the help and explaining how this works. I think I get it enough to think about waht specific implementation I want to use and how to get it done.

  • Oh I see, i used similar methods in other programs but it's true that I'd call the rendering functions each loop iteration. I guess construct doesn't let you do that. Not sure how I can use the PV to do it since I'd want to basically stay in that block of code until all units have moved. Maybe I can figure out a different method to do it, perhaps something involving enabling and disabling groups, that seems like it might work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The call that moves them is in a function that is not called every frame, and is only called at very specific times. When the function is called, I want each unit to move alone (e.g. first Unit 1 moves, then Unit 2 moves and so on and so on) and i want the movement of all units to resolve before continuing on with the rest of the program. I might not understand how construct works precisely, but I was under the impression that without some way to stay inside that function, it would just move the unit 1 pixel per function call.

  • First sorry for asking so many questions and thanks for all the help so far

    Here's my current problem. I have a bunch of Units (family of sprites) and I want to each one individually slide over from its current location to a target object in the family of Grid.

    It seems like it should be simple but i can't get it to work. What I did was I loop through each Units and do this:

    For each Units
      +Grid: Pick by Grid.Value('ID') Equal to Units.Value('Home')
           +While
             Distance(Units.X,Units.Y,Grid.X,Grid.Y)!=0  --> Units: Move 1 pixels at angle(Units.X,Units.Y,Grid.X,Grid.Y)[/code:261noit0]
    
    I would guess that the above would loop through its unit, then move it 1 pixel in the direction of the picked Grid, until the distance between them is 0.  However, when I do this, I get a warning that the While loop is infinite.
  • Ah figured this out finally, apparently the number was being saved as a string (used the 2d array utility to make the array, so either that has something to do with it or the fact that one row is strings makes the other be strings). In any case, int(ArrayValue) fixes it.

  • Here's a cap file and associated array data (In Layout1 file). There are two groups, Create Units From Array, and Create Units for Testing, which are not created from an array. One group (Create Units From Array) works correctly, while the other does not.

    The problem is this. The units belong to two teams, red and blue. The game works in rounds but in round one the Archer units (Princess Leia temporary graphics) can attack. If you click on the Archer unit, you see its radius highlighted in red, the units it can attack in blue, and the selected unit to attack in green. The unit should not be able to attack units on its own team.

    The problem is that if I create the units using the Create Units from Array group, for whatever reason this check fails and the unit can attack all units including those on its own team (see wher ethe blue boxes appear), even though all the relevant variables (Sprite.Value('OccupiedByPrevious'), Units.Value('Team'), Sprite.Value('ID') and Units.Value('Home')) seem to take the correct values as shown in the DebugText red text box. If I use the Create Units For Testing group everything works fine.

    Any idea what's going on? The function that draws the colored boxes is called Highlight Attack Targets.

    http://dl.dropbox.com/u/30864403/Boardgame.zip

  • I was wondering if I can somehow make a simple change so that if i resize the window, the size of the cells stays the same but I can see mroe of them. I'd like to use this to edit a very large array so this would help if possible.

  • Huh, it's getting weirder now. I also have an Is Dragging condition under the Is Var1 Equal to 0, but that does not activate, only the On Drop does. Now I'm really confused since if one is activating so should the other (they're under the same conditions, and you need to be dragging before you drop).

  • And if I replace the Invert Left Mouse button is down with On Left mouse button released, then the first click always triggers the On Drop condition. If i add a delay of 150 ms prior to setting Var 1 to 0, then it seems to work, though it is possible that the delay just makes the occurance more rare. Any idea what's going on? Seems like maybe there's a timing issue with the mouse / keyboard object perhaps? Or maybe I'm doing something wrong.

  • Another drag and drop issue (which may not be a bug)

    I have this code:

    On Click Object1 --> Enable Group 1
    
    ===Group 1=== (Deactivate by default)
    Is Var1 Equal to 1
      +[Invert] Left mouse button is down  --> Set Var 1 = 0
    
    Is Var 1 Equal to 0
      +On Drop Object1 -->  Do stuff[/code:3dztzwo3]
    
    It appears that the first click on Object1 (the one that activates group 1) once in a while triggers the On Drop condition.  It seems like it shouldn't since the left mouse button has to not be down before we get to that subevent.  And yet, once in a while it seems to do it.  Any ideas why?
  • So I have a bunch of units (sprites) in a board-game type of setup. There are two phases. In one phase, I click on the units and give them orders. In another phase I enable drag and drop behavior (deactivated in phase 1) to issue moves.

    The problem is, when I activate the drag and drop behavior, the units I clicked previously seem to enter "Being dragged" phase even though I use a Button to change between phases, and even though my mouse button is not, in fact, being held down. I can attach a cap but it's pretty confusing, so if any ideas come ot mind quickly let me know. Thanks

  • Oh I see, your Repeat is not nested under the picking for the first sprite. Huh, I guess I must not understand how picking works, removing the Repeat from the nesting makes everything work but I don't get why.

    Thanks though

Juryiel's avatar

Juryiel

Member since 30 Sep, 2010

None one is following Juryiel yet!

Trophy Case

  • 14-Year Club
  • Email Verified

Progress

15/44
How to earn trophies