impact's Recent Forum Activity

  • Oh, totally sorry - was my fault. I created my Player-Object in the wrong line (before the loop that actually determines how many players there are).

    Yeah, I've been working 24hours straight on this now. I should take a break.

    Thanks for the help though

  • Hello,

    another picking question from me.

    In my event sheet, I have a section "Setup", where there are several "Start of Layout"-events.

    One of them is setting up the gameworld, creating planets at random positions, then going through all the players and picking a random planet for them to have as homeworld.

    At a later stage, I trigger a an event "Every 1000 milliseconds", where I try to go through all the planets and update their gamestate. However, it seems that the script only picks a single planet: the one that's been last picked by the setup event (the homeworld of the last player added to the game in this case).

    Is there a way for me to manually tell Construct to forget about previously picked objects and start picking from scratch?

  • Ah, thanks. That's awesome

  • Hello,

    I still seem to get a bit confused about some of Construct's inner workings. Maybe you guys can help me out a bit.

    I have a family "Ships". I want to pick all ships that have their private variable "status" set to "Engaged" and then run several checks and actions on them.

    Does it work like this?

    Pick Ships by comparison: Ships('status') = "Engaged"
      Move to Enemy...
    [/code:l4jytlz0]
    
    or do I have to do it like this:
    
    [code:l4jytlz0]
    Pick Ships by comparison: Ships('status') = "Engaged"
      For each Ships
        Move to Enemy...
    [/code:l4jytlz0]
    
    Meaning: When I "Pick object by comparison", does it loop through all objects picked automatically within that event, or do I have to do the "For each object" to loop through them?
    And: Does the For each then loop through all the Ships, or just the ones I filtered through picking in the parent event?
  • Hi,

    how about an import/export function for event sheets?

    Would make it easier to back important code up or implement it in other projects.

  • I tried to reproduce it in a fresh project, but it doesn't give me the same problems. However, there is either something wrong, or I just don't know how to work this.

    What I did is this:

    I created two sprites - a red ball and a blue one. Red one is called "Fighter", blue one is "Bomber".

    I added them to the families "Ships" and "Selectables".

    I added RTS, LOS and Turret behaviour. I opened the event editor and added these events:

    Ships[LOS] -> On Object in LOS (Selectables)
       Ships[Turret] -> Acquire Target
    
    Ships[Turret] -> has target
       Start Flashing
    
    Ships[RTS] -> not moving
       Ships[RTS] -> Move to Position (Random(DisplayWidth), Random(DisplayHeight)
    [/code:2tpzwvl7]
    
    That worked as intended.
    When I removed LOS and Turret behavior from the fighter, they automatically got removed from the families, which is as it should be.
    However, the last event stopped working - it's still there and it hasn't changed at all, but both sprites don't move as they did before.
    I re-added the events for the turret and for LOS, but instead of "Ships" I just used "Bomber", as it still has those behaviors. Nothing. Complete standstill.
    Maybe I am doing something wrong, maybe I'm just tired, I don't know.
    Anyway, here it is.
    
    [url]http://www.thecursed.net/behaviour%20bug.cap[/url]
    
    Should I still submit it?
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I wouldn't use "for each" for going through larger families. Instead try "Pick object by value", where the object would be your family. It will pick all objects the expression you enter applies to.

    I did a little speed test for that - in my project I have the family "Ships".

    I displayed an object counter in my debug console and told Construct to create fighters (member of ships) until the fps drops below 60.

    In my code I did:

    for each (Ships)
       Ships('status') = "Idle"
          Tell ships to move to random position
          Set Ships('status') = "Roaming"
    [/code:3q3mibjp]
    
    My object count went up to close to 1.600 before my FPS dropped below 60.
    However, when I tried this:
    
    Pick (Ships) by value 'Status' = "Idle"
    etc.
    
    My object count went up to close to 16.000 before my FPS dropped below 60.
    So this is clearly faster.
  • Hello,

    I am saddened to say that it seems that my project just died

    I had a family called "Ships". That family contained two sprites: "Fighter" and "Bomber".

    Both sprites were also part of the family "Selectable Objects".

    During the development process, I experimented with behaviors a little bit to see what could be achieved, so both sprites had the "RTS", "Turret" and "Line of Sight" behaviors.

    When I selected my Fighter-Sprite and removed the "Turret" and "LOS" behaviors, because I didn't need them anymore, my project wouldn't run anymore.

    When trying to preview it, it would tell me: "Behavior name: 'Turret' not found".

    Now, I know that some might think that the problem lies in my event sheets buried somewhere, but my code is very well organized. Everything is stored and ordered into certain groups. Even deactivating all groups but "Setup", where he sets the screen resolution, would give me that error.

    I tried moving families around, I tried adding the behaviors again (when adding just "Turret" but not "LOS", it would tell me he couldn't find the behavior "RTS", which is CLEARLY a bug, so I had to re-add "LOS" too).

    When "Turret" and "LOS" were added again, my project would run, but all private variables for the families affected were "Read Only", meaning I could read them out in my debug console, but couldn't change them anymore, even though I checked during runtime that the correct events were triggered. This means for example:

    Pick all Ships where 'status' = "Idle"

    Set Ships('status') = "Roaming"

    Debug.Text = Debug & "Status should have been set here"

    And yes, I got the text on my debug console. However, the ships were still set to idle.

    I guess there is no hope but to start from scratch now?

  • This was exactly my question, thanks

    I wasn't sure if once you picked a set of objects by saying

    Select all structures where faction = "Blue"

    the next picking of object (pick object closest to...) would take place in that already picked set of objects or in a fresh, unfiltered set of all objects in the family

  • Thanks for your reply.

    I don't want to pick the blue member closest to my mouse, I want to pick the blue member closest to my mouse that is a structure.

    It would look like this:

    For all Structures in Blue Player

    Pick object closest to X/Y (MouseX, MouseY)

    Just that I don't think Construct supports something like that without using arrays. However, using arrays for this just feels...dirty. I was looking for a more elegant way to handle it.

  • Hello,

    I am not sure about this, maybe I am just tired, but I have a problem:

    I have one family for each player (Red Player, Blue Player, etc.). Those families hold all structures and units in my game.

    Now, I have separate families for those as well (Units for my units and Structures for my structures).

    What I need to do is this:

    Get the coordinates of my mouse cursor (I know, MouseX and MouseY) and see what friendly structure is closest to it.

    For example:

    I am the blue player, my cursor is closest to a red structure. However, this is not the one I want to pick in my game code. I want to ignore all structures but the blue ones and there pick the closest one.

    The way I see it, my only means of doing so would be to split the player families further, so that in addition to Units, Structures and Blue Player I would get Blue Structures and Blue Units.

    If at all possible, I would like to prevent that for sanity's sake.

    Any ideas? Maybe something I just overlooked?

    Cheers,

    Sebastian

  • I didn't very much, because I was still trying to get the hang of Construct. I wasn't sure how far I could go without it hitting me with exceptions. How far does it go? Do you use int or long int for the coordinates?

impact's avatar

impact

Member since 26 Nov, 2009

None one is following impact yet!

Trophy Case

  • 15-Year Club

Progress

15/44
How to earn trophies