Juryiel's Forum Posts

  • So I tried this code:

    SOL.Sprite.Value('Home')=System.globalvar("tempHome")

    and I get the message:

    SyntaxError: can't assign to function call

  • Thanks!

  • So if I create an object with events, say, Sprite, I can immediately do Sprite.Value('Var')=stuff, without doing any additional picking since the created object is picked.

    Is this the same with System.Create("Sprite") in python? If not, is there some way to pick the object?

  • Does this tutorial work under the latest construct? It seems the pythonLib event sheet is empty in all of the caps I open.

    EDIT: Ah my bad, I had another cap open and it was opening the wrong event sheet even though I was in the layout of the tutorial caps. But now I see it's there

  • Yeah I've been trying to do something similar with UID. I guess syntax like Sprite.index() won't work? And I'm curious, what exactly is in Sprite.SOL? or for that matter, what's in py.SOL and py.SOLi? I got these from a thread abbout the python picking plugin and I see how they're being used but not sure what they contain. E.g. how can you do while py.SOL as in that thread?

  • I've tried to look through some tutorials but haven't figured this out yet so I thought I'd ask:

    1. Is there a way to get the array indices for the list of Sprite (instances of the object Sprite) in the SOL?

    2. Will those indices always be the same if I create and destroy Sprites the same way? E.g. if i run two instances of the same program and do the same stuff in them, will the Sprite indices always be the same or is there some random factor involved? (I'm pretty sure they should be but just making sure)

  • I'd like the ability to make construct render a frame whenever I choose instead of only at the end of the event stack.

    Then I can do things like this more easily:

    While Var <=5
         Grow Object
          Render Frame
          Wait X ms
          Shrink Object
          Render Frame
          Wait X ms
          Var=Var+1[/code:2enbwzx9]
    
    Right now it seems if I want to update the display I have to wait for all the events to run.  In the case where I want events to not run until the display updates in a particular way (e.g. shrinking and growing an object repeatedly as a priming effect) I'd have to turn groups off and on and use variables to check what state I'm in (grow vs. shrink state etc) and it gets more complicated with more complex display updates.  Basically, I think if this is easy to add it would be nice to be able to stay inside a sub-block of events with some sort of loop yet still be able to update the display without having to resolve the entire event stack first.
  • Got the timer to work for a single delay. I guess if I can only have one timer per object, that means I need to use variables in conjunction with the On Timer command?

    It's wierd that just getting the program to halt for a preset amount of time is nontrivial, considering all the complex things I can do by just clicking a few things.

  • So I got this to work but now have another issue that probably has to do with similar misunderstandings of how construct works as previous ones I made in the thread. First, here's how I implemented it:

    I made 2 groups, "Main Game Events" and "Animate Movement"

    "Animate Movement" Group has teh following code (+> denote subevents/conditions -> denote actions)

    EDIT: Replaced code with image

    <img src="http://dl.dropbox.com/u/30864403/Untitled.png">

    That all works great. However, I want to put a Delay action before the Units: Move 3 pixels at blah blah blah. The reason is that I want to do some sort of priming effect to grab the player's attention to the unit that is about to move (so I'd put the actions for that effect right before the Units: Move action so something like, resize unit, delay, resize unit back, delay, Units: Move, etc etc).

    When I put in a delay, even if it's 1ms, it breaks everything, and causes ALL the units move not to the grids objects corresponding to them, but to grid objects in order from 1 to whatever number of units I have, and ALL units move together. To me this suggests that my picking for both Units and Grid is somehow broken by that delay, and it's just picking the first objects created by UID, etc. Why, and how can I fix it? Thanks again

  • 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.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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