How to spawn without leaving a gap?
http_gamesalad
Member Posts: 1,340
Well I made a random spawner, I made an integer called Random X & I told it to change attribute random(155,612) every 5 seconds. Then I put the Random X in my spawner and its working perfectly! The problem is that when the 5 seconds is up it tends to make a huge gap which I don't want. I want a continuous line that changes its position.. How would I do this? Thanks
Comments
bump?
Perhaps take a look at my spawn speed control demo. I'm not entirely sure if your problem is what I think it is, but if so that might help.
Follow the demos link in my signature.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I'm not sure what you mean. Are you saying 5 seconds is too long? Or after the first 5 seconds it takes longer for some reason?
@Armelline & @jsorr2 I want it to change its spawning position without leaving a gap. Like a continuous line that just changes its position.
But without leaving a gap when it does change its spawning postion
In the spawner, ever 0.5 seconds spawn actors ontop of spawner. and every 5 seconds, change position of spawner. that way when it changes position, its still spawning actors every 0.5 seconds.
You should upload an example template so we can tamper with it. or a youtube video of the problem.
@josrr I made this very quick template with the same exact coding! You'll see when the 5 seconds are up it changes position but it leaves a gap when it does, I want it to change position but to leave that gap when it does
@jsorr2 & @Armelline
This one is for Windows If youre on windows
This one is for Mac if youre on mac
I still don't really understand the issue. It seems to do exactly what you describe in the first post.
Can you take a screen shot and point an arrow at the gap you're talking about?
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@armelline when the 5 seconds are up and its time to change its x position sometimes it makes a black gap. I want the white line to change its position but without leaving a black gap. I want the white line to flow continuously without leaving a black gap but changing its position. Understand now?
No. Sorry Is this the gap you're referring to?
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline yup! Exactly what I'm talking about
Well that gap is appearing because you're moving the spawner to a random location. It is exactly what would be expected from your logic and the description you gave. Can you draw a picture of what you want to be happening?
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@armlline I would like there to be a white line where the gaps are
@Armelline something as close to possible like this
In that case, you need to be spawning another actor there. Off the top of my head, you'll need to record the previous and new X position of the spawner. The spawn a new actor halfway between, and set it to change its width to the distance between Old.Spawn.Location.X-Line.Width and New.Spawn.LocationX+Line.Width.
That'll get the effect you want. You'll need to make sure your spawning is accurate, though.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline how would I spawn the old and new position? & how would I tell the spawner to spawn that connecting platform?
You don't spawn the old and new position, you record them. Have game attributes for old.x and new.x, and when the spawner moves, record the current position to old.x before it moves, and once it moves record that location in new.x. After doing that, but before spawning the first of the new spawns for that location, spawn the connector.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline so it would be change attribute game.oldX to self.position.x and in the timer it'll put change attribute game.newX to self.position.x?
I'm really confused where to put all this stuff & in which timer and or rule..
Would you mind just typing out what I'm supposed to do because it's not working when I try..
Think about the steps you'd take if you were the computer.
Follow that through in your logic and you should get it to work
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@armlline would I use a change attribute or constrain attribute? I was asking if you could tell me the coding to put in
@Armelline Like I don't know if to use change attribute or constrain it! That's where I get confused.. I know its going to be something like "game.oldx" to "self.position.x" but I don't know which behavior to use. If you tell the coding to put in that'll be great!
Should only be needing change attributes.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline bro this isnt working at all.. Could you just tell me what to put in? I've been re reading this for like an hour now and trying to put those words into coding but its working or not making sense to me.. Can you just tell me what to put in and end my confusion?
bump?
My best guess is this:
2 attributes:
Old x and new x.
The first actor you have on the game,
Change attribute new x to self.positon.x
After 5 seconds change old x to new x.
Then when another actor is spawned after 5 seconds have the same rules:
Change attribute new x to self.position.x
So for example, old x = 50, new x = 100
You want to spawn a third, bridge actor to fill the gap in between the 2 main actors.
So bridge actor x = the number in between new x and old x(75), and the width of that actor is the complete difference of the two numbers. So bridge actor width = (100-50)
Now we need to figure out the Y of the bridge actor. Let's say the height of the normal actor is 200 and the Y position is 300 (of the 1st actor). To find the bottom of the 1st normal actor to spawn a bridge under it, just divide the height by 2, then minus that from its Y position. So 300-(200/2)=200
So now you have the y and x position to give to the bridge actor.
When bridge actor is spawned- change attribute self.Y to 200 and self.x to 75.
Change attribute self.width to 50.
Hopefully that will spawn an actor in between the 2 normal actors to fill the gap.
I'll have a play with your template tomorrow if I have time and you still cant figure it out (its 3am here!). It should be simple.
@jsorr2 thanks! really appreciate you taking time to help me with this issue!
@jsorr2 have you had time to play with the template?
I was really hoping we'd be able to get you to the solution without just handing it to you on a plate - people learn much better that way.
But now I just feel mean not showing you how to do it, so here.
Made with the latest Mac RC, but you should be able to open it.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support