WarpedOldMan's Recent Forum Activity

  • I'm going to bump this thread; I'm hoping that perhaps someone might see my problem.

    I'll also take the opportunity to correct a small error I was making (though sadly it doesn't solve my main problem).

    In the sixth action of the first event, I'm offsetting the Y position of the sprite extra, based on it's "arrayZ" value. However, I'm offsetting the sprites with a higher "arrayZ" value in the wrong direction. Sprites with an "arrayZ" value of 1 should appear to be higher than those with a value of 0.

    So instead of

    self.arrayY*(self.Height*0.50)+(self.arrayZ*(self.Height*0.5))+128[/code:2jywncrp]
    
    It should be 
    
    [code:2jywncrp]self.arrayY*(self.Height*0.50)-(self.arrayZ*(self.Height*0.5))+128[/code:2jywncrp]
    
    Also, for those (I hope) looking at my first post, I'll try to state somewhat more simply what I'm trying to do.
    
    In my example, I use an array to assign a unique X, Y, and Z to 50 sprites. I then use these values to give each sprite a coordinate (an X and Y position in the layout) that should simulate the effect of a 5x5x2 stack of blocks. I've checked, and I'm fairly sure that I've been mostly successful. No sprite shares all three values of their "arrayX/Y/Z" variables with another sprite and all positions in the array are filled and correspond to one sprite and only one.
    
    However, since my first post, I have discovered that though they don't share this, some of them do share X and Y coordinates in the layout when they should not, as they also share the same "arrayZ" value.
    
    I don't know why this is, but it's likely connected to why when I try to use a "for each" condition ordered by the sprite's "arrayZ" variable, that I get a jumbled mess instead of an ordered and properly depth-sorted stack.
  • I appreciate the reply, I'll spend some time reading what you have said to see if I can apply it to what I am doing.

    Simply put, the eventual goal was to use a 3D array or arrays to help me generate and keep track of terrain.

    Construct 2 is a 2D engine, but in my little game experiments I usually try to inject some element of depth to the game environment. This is often done with the use of layers and different parallax values; but there are other ways as well. Some have attempted to make use of an Isometric perspective, "top-down", or orthogonal.

    I admit that there is some confusion of the terms, but my understanding is that the orthogonal perspective differs from purely top-down perspective games in that it attempts to simulate an angled camera such as 45 degrees.

    What I'm trying to do here (at least I think) is to use an orthogonal perspective. This can be done without the use of an array object. It differs little from the creation of a normal tile-based top-down or isometric game. But I wanted to add an extra dimension if possible. And one idea that came to mind to simplify the process of assigning an X, Y, and Z dimensions to a sprite and managing those, was to use an array/s.

    When using an Isometric or Orthogonal perspective in a game, one of the basic functions of such an engine is the depth sorting of the various 2D elements, e.g. when a player sprite moves behind or in front of another object, the various sprites involved need to be layered accordingly. Normally, when using an orthogonal perspective, this is simple to do (though a bit more complex to make efficient). In my case, I'm just trying to add another somewhat imaginary dimension.

    I'm very much stumbling through this as that is my normal process with such experiments so it's possibly I've overlooked something very simple related to my problem.

    I'll try to add more information soon to better explain my problem and what I am trying to achieve.

  • So, I have an array with a width of 5, a height of 5, and a depth of 2.

    And, I have a sprite with a width of 70 and a height of 100.

    For testing purposes, the sprite that I am using is intended to be a cube viewed from an orthogonal perspective.

    Next what I do, is best demonstrated if I first start with another image.

    On a triggered event I spawn a sprite using the "for each element" condition of the array.

    The sprite has 3 instance variables, "arrayX", "arrayY", and "arrayZ". I don't know what order the "for each element" conditions uses to loop through the array, but that isn't particularly important. The intention is to essentially have a sprite (only one sprite) linked to each position in the array.

    Each time an object is created, I set it's instance variable e.g. "arrayX" to the current position in each dimension using Array.CurX/Y/Z.

    Once this is done I then use these instance variables to offset the position of the sprite in order to create a grid layout. Importantly though, there is a third dimension, so I offset the Y more depending on the sprite's "arrayZ" value, in this case either 0 or 1 I believe.

    On layout start, I get this

    Which, so far, is good and is exactly what I expected.

    Next, I have a function that I thought would be rather simple. When the function "sortz" is called, a "for each" loop is run, ordered by the sprite's "arrayZ" variable, the sprite is moved to the top of the layer. This should first run through all the sprites with an "arrayZ" value of 0, move them to the top of the layer, then move onto the sprites with an "arrayZ" value of 1 and move them to the top.

    Since no sprite with the same "arrayZ" value should share the same X and Y position on the array, it should create the effect of a stack of blocks.

    What I get is this

    What I expected to get is this

    I'm not really sure where to go from here. I had thought that if I had a sprite corresponding to each position in the array that the rest would be simple. I've been through the manual section regarding arrays and checked the forums for details on using 3D arrays.

    Also, using a "for each" loop, I've counted and there are 25 sprites with an "arrayZ" value of 0 and 25 with a value of 1. So I have the correct number of sprites in each layer.

    Note: I add "128" to each sprite's X and Y so that the group will be moved down and away from the top left corner of the viewport. This allows me to see all the sprites. The results are the same with or without this so I don't believe it is related to my problem.

    If necessary I can clarify further and even upload an example capx, but perhaps the solutions is something simple that I am overlooking.

  • I don't expect a quick reply, or any reply at all given the understandable inactivity of the CC section of the forum, but I'd hoped that someone might be able to help me with a problem.

    Currently, I'm doing this,

    <img src="http://i.imgur.com/5EYyIbs.png" border="0" />

    At the moment, storing this few of names in a hash table isn't inconvenient, but I feel like there should be a better way to do this. Eventually I will be needing to store more object names in the hash table.

    All of these objects are in a family, but I can't figure out a way to do a "For Each Object OID or Object type" in a family in order to condense these actions.

    A solution to this would help me in many other areas of my project as well so any ideas would be greatly appreciated.

    Update: I've solved my problem. "For Each" conditions and families seem to work just fine. I was just being an idiot and forgot to stringify the OIDs that I was storing. I can now store an entire families' objects' OIDs as names in a hashtable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Though I believe that there are multiple ways to accomplish this, I used this plugin.

    CSS Import Plugin

  • Sorry for the constant replies. I believe that I have solved this one. Although quite what I was doing wrong I am still not sure.

    Though it is unlikely that anyone else would want to do this, as far as I know, using the simple "z-index: -1'" in CSS seems to place the video in the background.

    Naturally you will want to ensure that all other layers above the video have a transparent background if you want to see the video.

  • Bump... again. I was just wondering if anyone knew what I might be doing wrong here? It may be something simple but it's also beyond my poor knowledge of construct 2 and CSS.

  • So I managed to manipulate the video element to an extent using CSS.

    My experience with CSS is quite limited however I can for example, hide the video with a simple: "visibility: hidden;".

    However, if I try to change the z ordering of the video element by applying: "z-index: -1;", The video seems to remain on top.

    I have placed other objects in the layout on multiple separate layers (some above the video object). When using "z-index: -1;", I see none of these other objects on top of the video.

    Would anyone have any thoughts or suggestions as to what I am doing wrong?

  • Ah, thank you. That sounds like an option worth pursuing. I'll try to post back here if I get it to work.

  • Bump.

    Just wanted to confirm that this is the final word on the issue and that as it stands, there exists no practical way to render a video in the background, behind dynamic elements in C2.

  • Thank you for pointing that out. I have looked into this plugin already though, and at it appears at least, by default, to render on top of all other elements in the C2 runtime. I don't know if it is possible to force a different behavior however.

  • Just a quick couple of questions regarding Construct 2.

    Is C2 capable of video playback? And if so, more importantly, can C2 render dynamic elements on top of the video region?

    I should add that a sprite animation is not a viable option in my case.

WarpedOldMan's avatar

WarpedOldMan

Member since 5 Feb, 2012

None one is following WarpedOldMan yet!

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies