Ashley's Forum Posts

  • I can't imagine why that would happen. Post a .cap and I'll see whats going on when I get my connection back.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Does this example help?

  • The RTS behavior has an implementation of A* pathfinding which is pretty good for navigating around complex maps. There's also stuff like intelligent aiming you might find interesting (see the attachment further down the thread - the maths in the original file has since been built in to Construct).

    Construct's event system is also very capable of coming up with an AI system. It is, however, entirely up to you to code it. Quite often questions along the lines of "How do I make AI?" are asked, which is too vague to answer. I think you can make a fairly good AI system in a much simpler way than most people think. All it is is automatically controlled enemy characters - it's easy to come up with some simple rules that make them interesting enemies in gameplay.

  • Yes, as you would expect the distance() expression uses the Pythagoras theorum as you have written. I'm sure it's working correctly, and it just returns the distance between two points - which is always positive and is unrelated to quadrants. I've used it for several things now and it works fine as far as I know!

  • using fast loops and one problem arised, it has to be very precise to work properly, meaning it needs to check every pixel step, and it lags the system having to do all of these checks, also if something gets too far lodged into another object it would run a continuous loop

    Yes, you have to do a lot of collision checks - doing this with the interpreted event system isn't going to be anywhere near as fast as the C++ implementation in the Construct runtime. Maybe it could be a system expression.

    Still, I like the idea of all objects having an editable 'hull' - a polygon you can draw around it. Both Physics and the dynamic lighting engine need a polygon instead of a bitmap mask and it would save you entering the same polygon twice. And a 'vector' collision alternative for Sprites could actually be fairly handy, but that's less of a priority. Animated sprites would make this a little trickier though... maybe it should be in the picture editor...

  • Yeah, atan will only give results over a range of angles (I forget, either just 0-90 or 0-180) which is kind of inconvenient if you want to measure an angle which is actually 270 degrees. Still, the C++ runtime library has a function called 'atan2' which works out the quadrants for you, which is what Construct uses. If you ever need atan2 for something else, I think angle(x, y, 0, 0) is equivalent to atan2(y, x). But the x,y and 0,0 might be the other way round. Can't remember.

  • Faggatron is right, angles can be outside the 0-360 range - 365 degrees "wraps around" back to 5 degrees again, because it's one full rotation plus 5 degrees. Same goes for negative, etc. If you want to display the result, add 180 to it Also, distance will give the distance in pixels, and if you're passing object coordinates, it will measure from their hot spots.

  • Yeah, I've read Firefox 3.1 will have an even faster javascript engine. But it's nice that this is spurring on competition. Maybe even Internet Explorer will get a faster javascript engine, it seems to be lost in the dust kicked up by Mozilla and Google right now

  • Are your sounds WAV files? The DirectSound object doesn't support MP3s, if I'm not mistaken.

    The samples on channels only support PCM WAVs, but the 'Play music' action supports MP3, WMA, anything Windows Media Player does.

  • oh yah, whats the distance/anglething do, never seen it before

    and are there more of them?

    All system expressions can be found by double clicking the system object in the object panel in the parameters dialog - or look up 'System Expressions' on the Wiki.

    If you have two points - (x1, y1) and (x2, y2), distance(x1, y1, x2, y2) gives the distance between the two points, and angle(x1, y1, x2, y2) gives the angle between them.

    I'll come back to this when I have an internet connection installed in my house!

  • WHAT?? I had no idea. I've done some reading, and I think I might be able to tweak it to use the Directsound emulator in Vista, but it will have very limited functionality (just stereo output as far as I can tell). I think I'm going to have to write a new XAudio2 plugin, which is the new sound API from Microsoft - but I've looked at it before and several effects and features from Directsound are missing in XAudio2.

    This is annoying!

  • The way normals can be calculated is by moving objects in a circle. If a ball, say, has collided with the edge of an arbitrarily shaped sprite, you can move the ball out by a radius (16 pixels works OK) and then collision test in a circle (say, at 4 degree intervals). By working out the average angle of the overlapping angles, you can calculate the approximate angle towards the surface, and inverting this gives you the normal.

  • It was made a long time ago in a very early beta. I think it needs a lot of work - as you say, I don't think anybody's made a real card game with it, so it doesn't really have a good way to handle the graphics and gameplay of a card game.

  • It is possible to calculate an approximate normal to the surface of something. The ball behavior does this internally, and I wrote some of the code for it. However, it's complicated and I'm sure you don't need it here.

    You should probably adopt a system a bit like the 8 direction movement's engine. The algorithm works like this:

    Attempt to move in X direction

    If X direction is blocked by solid, move back to original position

    Attempt to move in Y direction

    If Y direction is blocked by solid, move back to original position

    This per-axis check means if you are blocked by something, you can still move along the unblocked axis. It might not work perfectly for all shapes and sizes of wall, but it seems to do the job for the 8 direction movement. It is also a suitable solution... the normal detection algorithm might be quite tricky in events, and is definitely overkill for something this simple.

  • This would be a nice feature. In the meantime, here's the maths you need.

    When A collides with spinning B and you want A to stick on to B, first calculate the distance and angle offset from B to A and store these in private variables, eg.

    Set 'dist' to distance(B.X, B.Y, A.X, A.Y)

    Set 'ang' to angle(B.X, B.Y, A.X, A.Y) - B.angle

    then, from then on, always set A's X and Y co-ordinates to

    B.X + cos(A('ang') + B.angle) * A('dist')

    B.Y + sin(A('ang') + B.angle) * A('dist')

    I can't check this works right now but its the right idea. Some kind of 'Stick' feature would definitely be useful instead of this though.