Arcticus's Forum Posts

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

  • 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

  • I'm assuming it would return 200 unfortunately

    Not sure how I would do this, but still the current problem is that for some reason, as soon as Xcomp is a negative, BOTH Xcomp and Ycomp variables get messed up

  • Anyone have any idea why the expression:

    clamp(Player.Value('Xcomp'), cos(Player.Value('Vector')) * -200, cos(Player.Value('Vector')) * 200)

    is returning -200 as soon as Player.Value('Xcomp') goes below zero?

    cap here if you need:

    http://dl.dropbox.com/u/1289341/TimeTest.cap

    W and S to move, player looks at the mouse

  • I would love this feature

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It doesn't? that could explain a few picking problems i've been having.....

  • You could try a 'for each object (ordered)' loop and place all the objects that need sorting into a family

    Then use the aforementioned loop to order that family based on their Y co-ordinate in ascending order.

    I'm guessing this is the problem you needed help with, I just woke up so I'm all blurry lol

    If you're thinking it'll be too much on the processor due to large layouts and many objects, you could try the condition, 'Object is on-screen', that might help lower the amount of objects needing to be sorted, although I've never tried it.

  • Woohoo new personal towerclimb record of 4395!

    Dam gas appeared on an underwater level full of fish