Sumyjkl's Forum Posts

  • It sounds as if an else would do this.

    But I'm not sure I understand what you mean.

    Edit: Like this, I mean:

  • There are several ways to do AI for top down games, but it seems most of the time using things like pathfinder adds a whole new level of complexity and bugginess to the game. Namely, pathfinder doesn't care about solids. If it's moving along a path and that path has just become nonviable, it will still get to it's target location. I've considered a slightly more manual approach using an array for lost positions, but that seems a little intensive.

    The idea looks a little like this:

    But for a static world game where nothing ever, ever changes state, pathfinder is probably the easiest option.

    Oops, I think I just answered the wrong question. In terms of telling the AI whether to target you or not, line of sight is quite useful. In terms of roaming around, I have tried using instance variables for the AI to center around, and then it's moderately easy to just pick a position that is not overlapping solids/has line of sight in a random area around the AI.

  • That is odd indeed. Where do you initialize/add stuff to the array?

  • Just as some context, are you doing the for each every tick? I can't imagine any other reason for it being so slow. Literally wherever possible, it is downright necessary to make for each loops only run on triggers or after ensuring you have only picked the right instances / entries first.

  • You mean like this?

    at(x) can also be used at(x,y,z).

    It just points to the x y z coords in the array.

    The manual has some info, and it's not that different to normal programming arrays such as in C++.

  • I've never really used this so it's only theoretical, but couldn't you just use a variable for velocityY that updates at the end of the tick? Then it will always be the tick before the collision. I can't tell if this is what Silverforce is suggesting, but it may work.

  • Never would have suspected that. Thanks for the help!

    Here's the result. Seems to work so far.

  • So I just ran into this really stupid thing, and I have no idea how it would even be possible for it not to work.

    Basically, I have an object I move around with the physics behavior. The force with which it does this is defined in the object as an instance variable. There is literally no way to have a different amount of force in one direction than another. For some reason it doesn't understand this, and instead makes no changes to anything but the forward (if W down) movement force, meaning that I now have an object that moves five times faster left, right and backward than it does forward.

    Here're the events, and as you can see, the variable used, Self.acceleration, is the same for all of the directions.

    Yeah I know, you probably noticed the horrible inefficiencies I've been using. I'm working on it :P I've been lazy since the game's so small and doesn't have much CPU usage anyway.

    Here's the .capx

    [MediaFire]

    I would absolutely love to know if this is across other computers, at least. I just wonder what the hell it is.

  • Prominent

    Hmm, tried it and seemed to do something similar to what I was having trouble with before.

    Since I'm working with particles, everything is considered circular.

    Here's the capx I'm working on if you'd like to have a look at it. It's completely un-optimized, and incredibly rudimentary, so be ready for that.

    https://www.mediafire.com/?1mtseq1sjstesb3

    Edit:

    Wow. Tested something just then, and it worked. Mathematically, this formula would describe each particle's velocity if mass was equal:

    v = A.vel - (total magnitude of velocity) * ('polarity')

    Polarity meaning whether it is positive or negative.

    ∴ v = A.vel - (|A.vel|+|B.vel|) * (A.vel / |A.vel|)

    This works for perfectly straight collisions of objects with equal mass. Currently figuring out how to add mass into it.

    Edit: must have been imagining it. Doesn't do anything at all.

  • Prominent

    Basically the conservation of momentum.

    Two objects collide and are given force apart relative to their mass.

    If two objects with mass 1 collide at 10m/s, both receive velocity of 5m/s in opposite directions.

  • Hello. For a while now I've been doing some tests with some theories or physics laws, and I wanted to make manual collisions, without physics behavior, since it's way too complicated for something this simple - I don't need friction, rotation or collision polygons just to name a few.

    I've tried a bunch of formulas, both that I have tried to come up with and some I've made with a little advice from some people online. So far none have worked.

    I came across this, which someone said would be able to explain how to find the velocity of an object after collision with another, but all I can see is:

    And that involves the end result of the second particle, which means I can't use it for actually calculating one of the answers in the first place.

    Does anyone know what I should do?

    Thanks.

    Sumy

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Probably best would be to have a boolean instance variable that when true, goes to the frame after the one you want to skip if the current frame is the one you want to skip. You can't delete frames though, since you'd need to recompile the game every time.

    https://www.mediafire.com/?xw6xwprz0fppur0

  • I haven't tested this but it would be extremely inconsistent with other logic if that third touch would be anything but 0. One thing is for sure though: releasing the first touch won't change the index of any other touches.

    Edit: traditionally, this sort of system would fill the index of the lowest value first.

  • If you are using physics, use the joint actions, like a revolute joint. Otherwise you might be looking at using the normal pin behavior or setting position every frame. You can reference image point positions using [object].ImagePointX() and [object].ImagePointY().

    Example: http://www.mediafire.com/download/g0b23 ... ysics.capx

  • Also, there's no edit button.