Prowl's Forum Posts

  • Ram, you have me very confused now lol. So, I see where your gameplay spawns 2 different types of units, but I don't see separate code for the 2nd unit, or even the sprite for it anywhere.

    After looking more, I see how it has something to do with the alientype command you have built in, but im pretty lost on how you are using that function.

    In my case here, I have currently (and may have more in the future as I expand) 3 different sprites I want to be able to spawn from these points, and like the one you already helped me with, I want to be able to set their own spawn number, and spawn frequency.

  • Worked well Borgi thank you. Had to disable collision for object.a first so the 2 new objects wouldn't collide with it. I appreciate your help and knowledge!

  • So, I have objects spawning at random points, moving towards the player, with a random angle +/- a certain degrees, so their angle is never known. When that object is killed, it spawns 2 new objects. I want those 2 new objects to then move out a random +/- degrees in relation to the angle the object they spawned from was moving.

    Ex. Object 1 is moving at a 65 degree angle. I want the 2 new objects to start out moving at that 65 degree angle, but then have their own variance of +/-70 degrees

    If Object 1 is moving at 20 degrees, then I want +/-70 off of that 20 degree angle.

    Currently, the objects that spawn are set to angle (X,y) where x,y is the player

    Then rotate clockwise random (-25,25) to give some variance in where they go

    So, where do I go from there, to make the new spawned objects move in the direction I want them to (the direction the original object was going)

  • Rampack

    So I tried repeating this function for a 2nd object, and I cannot get it to work. I recreated the global values with the new name for the new object, and tried both just recreating the events and actions, as well as just copy pasting, and changing the gv's and sprites, and the 2nd object will not spawn. Any idea what I may be doing wrong? I also tried using a different spawn sprite just to see if that was it for some reason, which it wasnt.

  • I am working on a top down asteroids based space shooter. Currently while testing on PC (will import to mobile later) the set angle toward mouse command seems very rough while I'm shooting bullets. Meaning I can be shooting a bullets, but the bullet angles don't change from slight movements of the mouse, making hitting smaller objects at a distance pretty hard.

    How can I smoothen this function so the bullet angle changes even with sudden movements of the mouse

  • RAM! Thanks sir. That last bit worked perfect. I want to make sure I have a grasp on why, so I can help myself more going forward, because it took me a few tries to add the items myself (I didnt want to just copy your code and change the values, and I'm glad I didnt since I made some mistakes I learned form along the way.

    1) The create object line in the beginning, true, to false, makes it so it doesn't infinitely run the routine, and rather just runs 1 instance of it.

    2) Making it a sub event, rather than a complete list of separate events also accomplishes that

    3) Loopindex makes it so the asteroids actually spawn 1 at a time, up to the value listed, rather than all firing off at the same time, at the value listed

    Does that sound about right?

    1 last question, doesn't look like I gcan make a global value random(x,y) correct? It always sets value to 0. So if I want to have a little variance in my spawn time, I'll just have to ditch the GV, and put in the random(x,y) code with the loopindex?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok Ram, you def have me in the right direction and I'm almost there. I understand the functions a little more clearly now, but still have a problem translasting it. I tried to bring it over more or less exactly, but without the wave functionality you built in yours, since mine is going to be more of a level system rather than waves. When doing that, It wouldn't wait between spawns, and it is spawning them infinitely.

    I got into looking through tutorials of some of the functions, and I wonder would the repeat function be something that would work for me? In my mind, I want to take the system repeat function, tell it to repeat x amount of times, then I want it to spawn object with a random range delay, so I could do random (3, 5) and it would randomly spawn between every 3 to 5 seconds. Then lastly, I want to use your set frame option, to have it randomly choose which one to spawn from.

    End result, game randomly selects spawn point every 3-5 seconds, spawns a unit, and repeats that function x amount of times. I'm going to mess with it a little longer before I call it a night.

    Edit: So I messed around with it a bit longer, and I came up with something that to me logically should work perfect, but logic isnt winning here. Here is what I have

    Condition: Repeat 10 times

    Condition: Pick a random instance (spawn sprite selected)

    Action: System wait 5*loopindex

    Action: (Spawn sprite) spawn (Object sprite)

    What I expected was for it to spawn the object 10 times, once every 5 seconds at a random spawn. What I got was it just spawning an infinite amount of objects at every spawn. I also tried your for command that you used, and ended up with the same result. I think I'm close, just missing something small I'm sure.

  • Ram, that is helping me some, I'll mess around with it some more, but is there a way to add in a spawn limit for number of units spawned?

    Martin, I was trying to mess with arrays, also using the tutorial here on scirra's website, but they depict an actualy seeable object, but when I make an array, I do not actually see it. I think the array method, in reading how they work, may actually work great. Seems I can set an array on all 4 sides, and spawn from them at random. so I want to learn more about them.

    I will try to learn some by looking up some youtube video's, but I usually learn best by manipulating similar code to what I'm looking for, so may see if I can find some turorial that includes some base code for me to play with and learn off of.

  • Valhallen, that description sounds perfect. Now, the big question is, is there some way for the code to figure out the angle the original unit is moving at?

    So my code will know the objects angle of movement, then one new spawning object adds 90 degrees, the other subtracts, and they each move 25 pixels in their correct directions. What would that code look like, and what action would I be entering it under?

  • So, what I want to do, is create a bunch of spawn points off map, and set for enemies to spawn randomly at this spawn points periodically. I also want to have a specific total number of spawns.

    Example.

    I create 30 spawn points.

    I want 20 enemies to spawn, between these spawn points

    I want the enemies to spawn roughly within a 2 minute time frame

    So I want each spawn to lower a specific value, when that value reaches 0, the random spawning is turned off on all points.

    My goal is this helps future level creation easy, because all of the code is identical, and all I need to change is how many total enemies I want to spawn, so I just adjust that variable up to increase difficulty.

    A concern I have after doing this is, with a random function, will i sometimes have instances when I have a bulk of the spawns go off all at the same time? If so, is there a way to manage spawn frequency between all points to keep them within some sort of threshold. Like no more than x amount of units will spawn within y amount of seconds of each other... something of that nature.

  • I made a picture to better represent what I'm trying to do.Or even better, if I could say let the 1st one spawn in it's default position, and the 2nd one spawn anywhere within a certain radius of the 1st one at a random value, but far enough away so it doesn't collide with the 1st one upon spawn. But at the very least, I would like to have the 2nd object spawn either to the left, or right of the original object, based upon the direction of travel.

  • Mike, I just used your advice but instead did just random (-10, 10) and it seems to have the desired result, curious what the difference would be between that, and the combination of you using choose

  • Whenever I try to use your code, it says syntax error and highlights the parenthesis

  • Now if I do that, then the 2 just sit on top of each other with collision being disabled, plus, I really just don't want them to spawn on top of each other is it, there may be instances where they may collide, and I want that to happen.

  • So I have a moving object, when that object is killed, it spawns 2 new smaller objects. Issue I am having is, they spawn on top of each other, collide, and one of them shoots off into a random direction, when I want them both moving in the same general direction.

    Only way I found to avoid this was to use the move ahead action, but what I really want, is them to spawn side by side, relative to the angle they are moving at. Any help on how I might achieve this?