Prowl's Forum Posts

  • Very good stain, that did the trick, now I just gotta play with it to find out the best way to randomize it, and make 2 objects spawn without spawning on top of each other and going flying into random directions

  • Tried messing with that some, but I guess I'm not trying the right event action combo. Currently I'm trying to apply an impulse at an angle, and I guess im not sure what I would use within the angle field that would give me the actual angle the first object is moving at. Velocity x and Velocity y I guess just tells you the rate at which an object is moving at the y axis then the x axis... but I dont know how I would formulate that into an angle.

  • That's just creating it though isn't it? It's not creating the movement or setting the angle

  • Before I was using a bullet behavior where I could set angle towards position x,y then rotate clockwise random(-a,a) and get myself an easy angle variance.

    Now, I am using physics, because the collision of my objects as you could imagine was not having expected results.

    Currently, the best i have found, was I am doing

    Apply Impulse towards position, using a random(x,y), random (a,b)

    X,Y is +40%,-40% of the center point of my map's x coordinate, and a,b is 40% of the maps y coordinate. So I created myself a variance.

    Now, the result is, I do have a variance, but it seems to favor the center a lot, I have a decent idea as to why, because I've essentially created a box around my center point as the variance, and the most points actually cross the middle of that area.

    So, what would be a better way to actually create a variance for myself like I was doing with the bullet behavior?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, so my original spawning object is coded like this.

    ObjectA Apply Physics Impulse 5 towards random(x,y), random (a,b)

    It's the best way I know how to select a point on the map as the area I wanted the object to go, but have a variance so it doesn't always go to that object.

    Now, when ObjectA dies, it spawns 2 ObjectB's. I want ObjectB to move at the same angle ObjectA was moving, and then add in a variance on it.

    I did this exact thing with Bullet behavior, but of course I had physics problems, so now I am trying to do it with Physics behavior, and well, it's kicking my Butt trying to figure it out. None of the objecta.physics. commands looks like they will tell me the angle of motion. I cant use ObjectA.angle from what I have seen.

  • Coll, I ditched the bullet behavior, it did fix my problem, although now I have had to go through and reprogram all of my movements since the set angle and rotate commands are no longer good. So now, I have all my initially spawning objects that you see working somewhat right (I do have them randomized as to where they fly, but it seems like they favor going to the direct center a lot, here is my code for that if you have any suggestions that would work better

    Apply physics impulse 5 towards (random(288,672), random(162,378)

    My center point is 480,270, I think I did like a 40% variance there, but it seems that the variance realistically is much less than that, and favors the center, wondering if there are any suggestions on that.

    My 2nd issue. This is an asteroids based (not replica) space shooter. So asteroid a dies, it spawns 2 asteroid b's. Before with my bullet code, I could set an angle for B based on A, but now, when I try to do similar with impulses, my object B will not move. Here is what I was attempting to use for that

    Apply Impulse 5 at angle objectA.angle+random(-20,20)

    The object does not move, which I don't get since it's applying an impulse, I would think it would atleast move somewhere. Any idea where I am going wrong there?

  • Borgi, was hoping you could provide more help. Before I was using the bullet behavior, and setting the angle for that wasnt too hard. Now I am using Physics behaviors, and moving objects with impulses. Now, should I be using the apply impulse at angle action, and if so, how exactly do I get that to do what I was trying to do originally.

    Currently I have.. Physics impulse 5 at angle objecta.angle +random(-20,20) but my object isnt even moving with that, and not sure why because it seems like it should work.

  • Did a count, my largest asteroid that spawns, game is supposed to spawn 5, only counted 2, I think some of it is from a spawning problem, and other part of it is a separate issue I'm having with mass, these smaller asteroids that have 1/4 the mass, and 1/5 the size, are colliding with, and making the larger asteroids bounce the other way, so I think some are getting turned around before they even enter the actual gameplay field.

    Going to have to figure out how to solve that issue.

  • Ram I stuck with the original way of coding you gave me, and got it to work, everything works perfect now!

    1 last tweak id like to do if possible. Is there a way, once an object comes out of one of those spawn points, to turn off that specific spawn point for a specific period of time?

    Reason why, I think I am having multiple objects fire out of the same spawn at close to the same time, and their collisions are making those objects reflect off and never come on screen, and it's throwing off the obtainable game score. So, object spawns, spawn point waits for 2 seconds before it can be selected as a random spawn point again... or any other clever way to alleviate that problem

  • Trying to beat the forum here, I dont have enough rep to post links, string the below together just add in the h t t p

    jmp.sh/b/SmHi8Zi

    OrXIj1g0kglLG

    Just watch a little while, and youll notice what I am talking about.

  • What I have is say Object A is approx 5-6x the size of Object B, and I set the density to be 4x higher. Yet, sometimes when object A and B collide, Object A will change trajectory, and Object B stays on the same path. Sometimes they bounce off of each other as if they are equal, and sometimes Object B is the one that moves, and Object A keeps going. Sometimes it seems like the angle of impact may have something to do with it (collision points are rather jagged, rather than round) but in any event, I wouldn't think under any circumstance, something with 6x the size and 4x the density should be turned completely around by the smaller object, while they smaller object keeps moving and it's path completely unaltered.

  • I'll test here later tonight but do you think I'll be able to have them set to spawn at the same time? So object 1 will have a random spawn between say 6 to 8 seconds, object 2 random spawn 4,6 seconds, and objectives 3 2, 4 seconds.

  • Will donly Ram, I'll mess with it some tonight and let you know how it goes. Thanks again.

  • Ok I get it. How about actually setting in this case, each animation frame to have different spawn numbers, and different spawn frequency.

  • I have a 0 gravity setting (space) and have objects of different size and mass colliding. I have set the world gravity to 0, and set different densities to correspond with the size of my objects. When they collide though, it seems to not actually matter. I can have my smallest object with a density of 1, hit my largest object with a density of 80, and given the angle, the large object may start moving in the opposite direction, and the small object not change course at all, or they collide and bounce off each other at the same rate. It seems to be pretty random, as if they do not recognize their density or mass at all.

    Is there something else I am missing? I have 3 objects, I want Object 2 to have 1/2 the mass of object 1, and object 3 to have 1/2 the mass of object 2, and for them to act that way when colliding in space.