Arcticus's Recent Forum Activity

  • TL;DR = in most cases it wouldn't work

    I don't think layers for elevations would work from what I understand.

    For example, if the player is in front of two stacked boxes and jumps, on his way up, at one point he would have to change layers. Where would this change happen? in this case, most likely as soon as he jumps. That should look fine, but what if the player is standing -behind- the two stacked boxes? The change between layers would have to happen as soon as the player's bottom '3d' side cleared the top '3d' side of the box on the bottom of the stack, otherwise, as soon as he jumped, he would appear in front of the bottom box, even though he should be behind.

    And in both cases, if there was another sprite nearby on the first elevation layer overlapping the player in a certain way (depending on which scenario), the layer swap would screw up the sorting.

    The best way I've found for figuring out how one sprite should behave in relation to another is to use this kind of zone diagram I drew up:

    <img src="http://dl.dropbox.com/u/1289341/Help/IsoZones.gif">

    This is how another object should behave if any part of it is in any of the following zones: (the zones are infinitely long obviously)

    [Blue] = In front, regardless of height

    [Red] = Behind, regardless of height

    [Green] = In front

    [Orange] = Behind

    [None] = doesn't really affect sort order but -can- be ordered by (screen Y + height from ground) if you really have to

    Green and Orange override Blue and Red

    Naturally, you'd have to define front and back X edges, front and back Y edges and bottom and top edges all in variables for each object. When I say X and Y here, I mean as isometric X and Y, not screen co-ordinates

    With clever coding, since you've defined the '3d' bounding box, you could probably figure out a way to sort them regardless of size.

    I know this is a pretty long winded answer to your question, I mostly put this here as a resource for anyone else looking for insight into figuring out how to go about sorting, or maybe it will give someone an awesome idea on how to solve it!

  • With the help of a stranger on the internet, I've got the code to a point where its -almost- perfect sorting-wise, however, the loop is so long and convoluted that it slows the game down exponentially and i can't really have more than about 10 objects on the screen at once without any slow down.

    And yes i've tried only updating the sorting only when something changes, it doesn't work very well with the current loop. So i'm taking a little break from it until i can think up something better.

    I REALLY want a working iso engine

  • Well I updated Construct and now it works fine? odd

  • Well now I know something is REALLY up, here's a look at what I get when I run it

    <img src="http://dl.dropbox.com/u/1289341/Help/Fams.gif">

    Maybe I'll try deleting the persist file

  • I wouldn't mind some help with this as I'm about to add a bunch more variables

  • Ok so in one of my projects, I was working with various instances of the one object. As the project progressed, I needed to add more and more private variables to the object as I needed them, for ease of reading I had to move the order of the variables around a bit.

    Later on I had to compare the object to different instances of itself, so to do so, I added the object to a family and everything worked fine.

    Even later on in the project I decided that I would like to have multiple objects instead of different instances of the same object everywhere. So I added the current object to another family and painstakingly went through all the events, replacing the objects events with the new family (there really needs to be a TGF style 'replace object A with object B' in terms of events).

    Now nothing works properly! Trying to get to the source, I made the program print out all the variables of whichever object in the newly created family that the mouse was over and low and behold, the variables were in the wrong order!!

    They were in the correct order in the events, but its like they got mixed up in the new family cause I moved them around in the original object way before the new family even existed!

    I made a demo cap here that demonstrates it so well that I originally wanted two lists, one in order and another out of order but they're BOTH out of order due to this bug(?)

    http://dl.dropbox.com/u/1289341/Help/fams.cap

    I'm not entirely sure if this is a bug or if i'm just doing something wrong with family management :S

  • I believe what he meant was, 'How do I make a sprite stay a certain distance from the player in the angle he's facing'

    The way its worded could easily be mistaken for, 'How do I make one sprite always appear on top of another'

    However in this case I would also recommend putting it in a UI layer above the game layer anyway so, for example, the aiming reticle doesn't get hidden by some wall you added later.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think what you want is something like

    Always set Reticle position to:

    X: Player.X + cos(Player.Angle) * Desired distance from player

    Y: Player.Y + sin(Player.Angle) * Desired distance from player

  • Logic-wise, version three is asking:

    If the user clicks and releases the button AT THE SAME TIME! :O

    Which is impossible.

    The sub-event one is kinda doing the same thing. Sub-events are very useful for compressing code where one or more conditions are common to all of them.

    A good example would be instead of using the following four events:

    + System: Is global variable 'Var' Equal to 1

    + MouseKeyboard: Key Up arrow is down

    -> Sprite: Set 'Direction' to "Up"

    + System: Is global variable 'Var' Equal to 1

    + MouseKeyboard: Key Up arrow is down

    -> Sprite: Set 'Direction' to "Up"

    + System: Is global variable 'Var' Equal to 1

    + MouseKeyboard: Key Left arrow is down

    -> Sprite: Set 'Direction' to "Left"

    + System: Is global variable 'Var' Equal to 1

    + MouseKeyboard: Key Left arrow is down

    -> Sprite: Set 'Direction' to "Right"

    You could use one event with four sub-events like so:

    + System: Is global variable 'Var' Equal to 1

    + MouseKeyboard: Key Up arrow is down

    -> Sprite: Set 'Direction' to "Up"

    + MouseKeyboard: Key Down arrow is down

    -> Sprite: Set 'Direction' to "Down"

    + MouseKeyboard: Key Left arrow is down

    -> Sprite: Set 'Direction' to "Left"

    + MouseKeyboard: Key Left arrow is down

    -> Sprite: Set 'Direction' to "Right"

    I hope that's legible, a subevent triggers when the event its below is true, in this case, if Var equals 1, then it runs the arrow events. There are other handy uses for them too but it gets a little situation specific I find. I'll be happy to try and explain it better if you didn't understand my ramblings.

    In any case, I fixed up your angle of motion cap without using any subevents anyway Go have a look if you haven't already

  • I fixed it for you, using a similar method to what StAtrill mentioned.

    Also I cleaned up the code a little by using a family, because at the moment, you don't want either of the sprites to behave any differently from each other code-wise, so its better than having the same code running twice!

    http://dl.dropbox.com/u/1289341/Help/Traffic3.cap

  • In theory that looks like it should work, I even made a little text box display those values to make sure they were the inverse of each other at all times, which they were, the minimum one was always a negative and the other, always a positive.

    Yet when I move my player around using that method, he now moves MEGA twitchy, basically when Xcomp goes from a negative to a positive, he then goes max speed in the positive direction, and vice versa when going from positive to negative. It doesn't make sense!

  • I think I fixed it:

    clamp(Player.Value('Xcomp'), abs(cos(Player.Value('Vector')) * global('MaxSpeed')) * -1, abs(cos(Player.Value('Vector')) * global('MaxSpeed')))

    Absolute value ftw

Arcticus's avatar

Arcticus

Member since 23 Nov, 2007

None one is following Arcticus yet!

Trophy Case

Arcticus has no trophies yet!

How to earn trophies