Shindoh's Forum Posts

  • From what I can see, the problem is that You don't specify which instances private variable to use for the event. So it will just use the 'spiketime' variable of the the first created spikes Sprite.

    All You need to do is add the System Condition 'For Each Object' on top of both events. This will pick each instance and its own variables.

  • I love You. <img src="smileys/smiley1.gif" border="0" align="middle" />

    Yeah, I was reading about loop index earlier today, but didn't really think about this.

  • I've been trying to find a way to access the order information of objects. Naturally, in which order they have been created, and have them carry their information in each instance. As in, this is the first instance, that has been created of this object, this one the second, the third, etc. ... .

    The only ways I could think of are too complicated, when I feel like there is surely an easy way.

    I would do it with a global variable, and that is what I don't like, to have something external like that. Since, if different Objects get plentysome, I'd end up with loads of global variables just for ordering the instances of each Object.

    I would basically do something like this:

    We have:

    + globalvar('IDCounter') = 0

    + SpriteObject

    + SpriteObjectVar('IndexID') = 0

    We do:

    + For Each SpriteObject (Ordered by SpriteObject.UID - Ascending)

    -> Add +1 to global('IDCounter')

    -> SpriteObject.SetValue('IndexID') = global('IDCounter')

    Thank You in advance.

  • That's funny, lol. I was just searching about a very similar question, hash tables vs arrays. I didn't find that much yet, just checking the Help Section for some recent things, and I see a topic about almost exactly my question.

  • it automatically AA's the graphic to look like its making sub pixel movement if you have linear filtering (the default sampling mode) set. this can look ugly sometimes though. you can change the sampling mode (which causes tearing instead of subpixel blurring).

    rounding the position when you want it to be non blurry (example when your character isnt moving) will fix the blurred look.

    Construct uses Linear Sampling, but are You sure for everything? Because moving the sprite with 0.1 every step doesn't move the sprite at all, until the next whole number. In the info box it sais the sampling is just used for rotations and scaling.

  • I've been wondering how Sprites are moved, if the given value for example is .X += 5.5 X. With decimal numbers. Since the smallest possible value of the screen basically is 1px, how are images moved when they have decimal numbers?

    Are the numbers just automatically rounded? Or nearby pixels illuminated weaker so it appears halfway on it? I don't know, how is it handled?

    EDIT: I also noticed an odd behaviour in Debug Mode. For a moment I thought, the sprite is just moved, if the position has updated to a new whole number. I came to this conclusion by moving the sprite += 0.5px on X every step a button is down, while running with 2FPS. I pressed the button at different intervals.

    But when I was moving it by 0.1px every step, sometimes it was updating the screen and moving the sprite by 1px, when the current X position was 10.8 and sometimes at 10.6 (10 being a placeholder for any whole number here).

    And then sometimes it wouldn't move at all, if X was a whole number and the screen was updated the next time.

    Related to this I would actually like to know how exactly using a fixed framerate affects the reading of the events? - First I thought, the internal processing speed of the events is not affected, and it will just keep reading the event list top to bottom as fast as it can and render the image, and then just wait for the given fixed framerate interval time to pass, until it updates the screen.

    Now I feel like it actually also reads the event list with a slower speed, because sometimes it doesn't recognize the button input, if I press it at different times until the next reading (which I assume is signaled by the blink that is visible in the debugger window). And it seems to recognize the button press, if I press it shortly before the next tick, and not recognize it, if I press it directly with the next tick starting (the blink happening).

    If it was reading the events as fast as possible, I would assume it to recognize the button press at the beginning of the tick, not at the end.

    However if it was actually processing the events slower, I am confused about how it would handle the rendering of the image into the backbuffer.

  • I see. Thank You again, tulamide. That's why I love forums, and especially this place. It's full of knowledge, and full of people with knowledge who can help each other to learn about something they are interested in and share a passion for.

    Although I still think it's weird to essentially have the same condition behave differently, depending on where it is checked from. At least the different checking behaviour should be clear.

    If I check for 'Is Overlapping', then I expect it to be a continuous check and not a one time result. And perform actions according to "as long as overlapping". If I wanted them to be executed once I'd use the 'perform once' expression.

    But this way it would be useless in a while loop, unless I used the System Condition.

    In other words, if I applied actions to the Sprite Condition, it would make no difference if they are in a while loop or not, this way. It would behave the same.

  • But tulamide, then I still don't understand this behaviour.

    I do understand what You are saying.

    Let me show You how I tested it and it didn't work (Events are in order):

    + Always

    -> Sprite1: Set X to MouseX

    -> Sprite1: Set Y to MouseY

    + While

    + Sprite1: Overlaps Sprite2

    -> Sprite1: Set X to .X - 1

    What should now happen (to my understanding), is that Mouse.X will always be overwritten, when Sprite1 overlaps Sprite2. This should result in Sprite1 always moving along the left border of Sprite2, whenever it tries to overlap Sprite2.

    However what happens visually is nothing at all in this case. Because it behaves like in another test I did before, and just moves Sprite1 back -1px .X every Tick instead of in one.

    Now when I do it like this:

    + Always

    -> Sprite1: Set X to MouseX

    -> Sprite1: Set Y to MouseY

    + While

    + System: Is Overlapping(Advanced) Sprite1 (PICK) Overlaps Sprite2 (PICK)

    -> Sprite1: Set X to .X - 1

    It works. (The Pick option doesn't even matter in this case, even when I didn't pick either it worked)

  • I see.

    I never worked pixel based, because I prefer time based, but couldn't you just make your own push out routine?

    If the player sprite overlaps the left side of the ellipse, then repeat sending the player sprite to .X - 1 until it doesn't overlap anymore.

    That's a good idea. But then again, how are You able to state when it doesn't overlap anymore, when You don't know where the pixel border is?

    EDIT: Okay, I just got it! <img src="smileys/smiley4.gif" border="0" align="middle" /> We just need to use a While Loop! While Player Overlaps, substract .X -= 1. Thank You!! I should think time based more often.

    That means While loops inside the same Tick, until it falsifies?

    2nd EDIT: Wait, this is weird. I guess I was happy a little too soon?

    In theory, if While worked that way, and I am also thinking it should (from what I read now), it would be perfect and very useful. But I just made a simple test, checking the Overlap between two objects with the While condition.

    I used the Overlap condition check from the Player Object, and set .X back -1, while it is overlapping.

    However in reality the Player was set back -1 every Tick now, as long as it was overlapping. Not -1 in one Tick until it wouldn't overlap anymore. So You could watch as it was pushed back out in slow motion.

    Then I tried the System Objects Overlapping(Advanced) condition and basically did the same as above. But this time it worked exactly as it should, it would be pushed back instantanously the next Tick.

    Why? Please don't tell me it's another bug, lol.

  • I wouldn't know of any way of getting those informations, unless you know the shape of the object and calculate it.

    But what you describe sounds like a typical job for a pixel shader. Is there a reason for trying to do it on the cpu side?

    Thanks for Your time again, tulamide.

    And yes, there is a reason. I am trying to use it for collision calculations.

    Let's say we have an Ellipse Sprite, that we use as a collision mask.

    Now if the Player Sprite, or any other movable Object Sprite overlaps the Ellipse in one Tick, let's say by 5 pixels, I want to position the Player Sprites border back exactly those 5 pixels it overlapped.

    If for example the Right Pixel Border of the PlayerSprite overlaps the Left Border of the EllipseSprite by 5px on X, move the PlayerSprite.X -= 5px.

    And similar procedures for .Y values and other borders.

    I really need those pixel coordinates, to know where the border between transparency and opaque pixels is, so I can do accurate backplacing for the collision.

    I don't know of another way doing it accurately right now.

    I can think of some workarounds, but they would all be huge time consumptions compared to this and would still lack the same precision, while similar.

    It's driving me slightly mad. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • I've been trying to find information about pixel coordinates and the likes like crazy today, without any luck. I've gotten another idea how to do what I wanted to do then.

    But I still don't know how to do it, or where else to look for answers on this.

    Is there a way to check how much (how many pixels) one side of an object has overlapped another objects pixel area?

    Related to that I would also like to know if there is a way to retrieve the furthermost pixels coordinates of any side. Let's say the furthermost pixel on the left side of the sprite, checking from the hotspot. So meaning left relative to the hotspot.

    I am basically just trying to find a way to exclude transparency of sprites in calculations. And starting with pixels whose opacity or alpha level is higher than a certain amount.

  • Okay, I found out what was happening.

    It's a similar or the same bug I had a good while before, and I think I reported too.

    One of the Events I used to trigger the SetAnimation to Attack, had an OR condition sandwiched in the middle, and it was in a Group.

    When I moved the whole Event out of the Group and into the main Event List, it worked exactly as expected. Very weird behaviour though. I mean with the Bug.

    And thanks for Your reply, tulamide. Yes, I was thinking about exactly that, how the previous Events' frame is being rendered in the present processing and what delays there could be. But knowing all that made it even more weird. How it could even set the Animation to 'Attack?, and IgnoreInput to 1, while Attack is playing, when that is only possible while Attack = 1. And since Attack only has 1 Frame, how could IgnoreInput be set to 1, when Attack = 0?

  • I was fairly sure I understood everything now, the flow and order in what things happen in a Tick in the Event List.

    Today I was using the Debugger, because of an unwanted result, to see if I could find something there, without any real clue. But I noticed something else, that I found strange.

    First let me give You the Events (in order, top to bottom, as they appear in the Event List, excluding unrelated Events inbetween) related to this:

    If MouseKeyboard PressButton 'F' -> Set Attack = 1

    ---------ELSE------------------- -> Set Attack = 0

    If Attack = 1 -> Set Animation 'Attack'

    If AnimationPlaying 'Attack' -> Set IgnoreInput = 1

    If AnimationFinished 'Attack' -> Set IgnoreInput = 0

    (IgnoreInput just ignores input for movement)

    Now in theory what I thought should happen (After pressing 'F') is this:

    Tick 1:

    • During the duration of this Tick, Attack = 1.
    • Animation is set to 'Attack'.
    • Now I don't know about this for sure, but since Animation has been set to 'Attack' in this Tick above, IgnoreInput should already be = 1, unless AnimationPlaying is only registered for the next Tick, when it has actually been finished rendering. (The AttackAnimation is only 1 Frame right now, placeholder)

    Tick 2:

    • IgnoreInput = 1 or 0, Depending on how Animation is registered by the program, as I said above.
    • We see the AttackAnimation for the 1 frame it has.

    But this is what I see in Debug Mode (after 'F' has been pressed):

    • Attack = 1
    • Attack = 0; IgnoreInput = 1
    • Attack = 0; IgnoreInput = 0; Animation = Attack

    After pressing 'F', Attack is first set to 1.

    Then exactly as Attack = 0, IgnoreInput = 1.

    Then exactly as IgnoreInput = 0, we see the Animation.

    Could someone please explain to me how and in what order the Events are being read and executed and values assigned?

    Thank You very much.

    EDIT:

    Weird, I just tried to replicate this behaviour with the Event Flow I described, in a new .cap. Now it behaves exactly as I thought. It must have something to do with other Events interfering then.

  • You could simply use the "OR" addition in your event

    Player Animation Punch is playing > Do something

    OR

    Player Animation Kick is playing

    OR

    Player Animation Bite XD is playing

    If You have about 35 possible different follow up animations for a character, that could get huge though. I was also considering that, as a last resort though.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is it possible to in any way use the Sub-Animation System to check "If any of the following animations are playing/finished/etc. ..." ?

    Let's say we have a main animation called "Attack", and below that a lot of possible follow up chain animations in sub-animations. So in that case "If any animations of type "Attack" are playing, do this...".

    Thanks in advance.