faggatron's Forum Posts

  • Distance works fine for me... you sure you're hotspots are right or something?

    also, the angle goes negative depending on the direction of the object,

    either you can have angles going from 0 to 360 or -180 to 180

    You should be able to just forget about it, any time you'll probably need the angle (trig) it won't matter that it's going negative. Trig functions are periodic which means for example sin(x)=sin(x+360), so it won't actually make a difference to any calculations you have to do with the angle. (unless you want to display it from 0 to 360 or something).

  • man you really need to learn trig !

    set X to .x+speed*cos(angle)

    set Y to .y+speed*sin(angle)

    what you want are actually the sin and cos functions themselves!

    they go from -1 to 1 like the picture above, if you plot X=cosA and Y=sinA for every value of A, it will give you a circle with radius 1.

    so if the angle is 0, (you're going horizontally to the right) cos(angle) gives 1, and sin angle gives 0, so you'll be moving 1 to the right. if angle is 90 (vertical) sin(angle) gives 1, and you're Y will be moving correctly.

    It's tempting to make a trigonometry 101 page for the wiki, though I've been doing it for so long I don't know what it's like for someone who's never learnt it .

    [quote:kgmy9vbb]i was just wondering if this existed already, because i made this all by myself but im sure some 1700's mathematician has already done it lol. so is there a way?

    try some 4000 year old mathematician lol

  • its quite complicated, that angle function is a lifesaver.

    If you haven't learnt trig yet its probably no use proving a formula to you.

    the actual formula is arctan((y2-y1)/(x2-x1)) but it's made more complicated by getting a sign error in different quadrants, so this formula makes it really nice.

    the basic idea is:

    <img src="http://www.quotecats.com/what/trig%20is%20pro.PNG">

    (any excuse to do some maths)

  • angle(ax,ay,bx,by)

  • please add an option to the particle object so you can randomise the initial speed of the particles, at the moment the speed randomiser happens constantly, I'd like to be able to set a randomiser at the start aswell.

  • Does typing in the names actually work?

    I can't get it to

    either its a bug or im an idiot

    also, when find and replace is made propperly, it should be capable of changing the layer numbers to layer names in seconds

  • Blur horizontal/blur vertical are the two slowest effects.

    Ha! I wish I'd known this before I used them on pretty much everything

    also that optimisation tips wiki page is incredibly helpful, fps drops suck.

  • I was thinking, would this be a nice thing to add for the box object? (or maybe polygon object in future?)

  • To be honest I gave up on this angle fairly quickly after I realised there was no way it was going to be simple and there is obviously a better way. Didn't think to do it for per axis like that though, so thanks for that

    I'd quite like an idea of how to find this elusive angle because I find it interesting, and I've not been able to come up with anything at all.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • closest/furthest value function, so like you have

    closest(sprite.x,1,1000) it would output 1 or 1000 depending on which sprite.x is closer to

    at the moment its quite complicated to work out

  • Usually happens because of the order of events:

    if you have

    detector set x to sprite.x

    sprite set x to whatever

    then on the first event sprite.x isn't changed yet, it then gets changed after so the sprite is in a different position.

    if you change it to

    sprite set x whatever

    detector set x sprite.x

    it should work

  • I know I am definately making it more complicated than it needs to be, I mean its a fairly simple problem, but it wont work just having it push out in the same direction it goes in, since then it won't move at all

    <img src="http://www.quotecats.com/what/argh.PNG">

    (here red is the movement of the object, green is the reaction movement I want, and blue is what should happen)

    I want it to do it accurately, dunno I can't think of a better way.

  • well basically its a top down game, and I want it for the walls, so you're going around and theres a wall at an odd angle, when you walk into the wall, you want it to give a normal reaction and stop all motion in that direction. so you'd have like while sprite overlaps wall -> set x+cos(normal) y+sin(normal)

    I realise there might well be a better way of doing this, everything I've tried though I've come up against this.

    was the mario galaxy thing you mentioned this? because I actually looked at this for inspiration and couldnt work out what the heck was going on

    My latest thought has been to create some objects in the wall, roughly at the collision, then push them out of the wall in your direction at the speed you came in, when they're out, can make a line between them which should be a tangent, then can find normal from that. Prob wont work though heh.

    EDIT: what if the walls are limited to be boxes? theres gotta be a way of working it out correctly from that right?

  • you must also not that in order to find normals you need vector graphics, raster graphics have no information on there faces vertexes and edges are non existant, they are just pixel or no pixel (bitmap) information so there is no "real" surface normal, thats why i use this technique, at least for raster graphics,

    Yeah this is the trouble, it means instead of just being able to do it really nice you gotta attempt to hack an approximation

    another way to go about it is to make certain objects (flat rectangle detectors) and set a value to the angle of that object, then you place those all over the surface of the terrain (whatever it is, and manually rotate them for each surface, making sure you leave a bit portruding so it can "catch" objects, it takes more time, but it works alot better. u then set the sprites angle or wtv u need to the current detector its colliding with

    you mean have a fake wall graphic and surround it on each edge with ones with a set normal value? I'd rather attempt a solution that'll do it for any wall, if for nothing else, for ease of level design

    I'll give the other method a shot, see what happens

  • What's the best way of going about finding a normal angle to an edge of a sprite.

    basically the angle of the green arrows in this picture at each of the points:

    <img src="http://www.quotecats.com/what/normalz.PNG">

    I can't think of a way that will do it at all accurately, efficiently or nicely. I need it to force an object out of a wall at the correct angle. Also this (surely) is needed for ball bounces and things (reversing the component of velocity in that direction).