mjemje
|
  |
| Joined: 28 Mar 2009 |
| Total Posts: 25787 |
|
|
| 22 Nov 2013 10:29 PM |
Here's a test script I made that causes bullet objects to scroll downward from the top of the screen.
wait(2.5) while true do t = wait() script.Parent.frame.Text = t script.Parent.fps.Text = 1/t for n = 1, 2 do q = script.Parent.Parent.Parent.Bullet:clone() q.Parent = script.Parent q.PosX.Value = math.random(0,10000)/10000 q.Position = UDim2.new(q.PosX.Value, 0, q.PosY.Value, 0) end q2 = script.Parent:getChildren() for i = 1, #q2 do if q2[i].Name == "Bullet" then q2[i].PosY.Value = q2[i].PosY.Value + (t * 0.1) q2[i].Position = UDim2.new(q2[i].PosX.Value, 0, q2[i].PosY.Value, 0) if q2[i].Position.Y.Scale > 1 then q2[i]:destroy() end end end end
It works. GUI "Bullet" objects are randomly created and scroll down the screen until they disappear from view, at which point they are deleted. In local play, it's flawless unless I boost the n maximum value in the first repeat to something stupid so it spawns, say, 15 bullets instead of 2. In normal play, however, bullets move in short leaps instead of the smooth movement seen in edit mode. Is this a simple limit of how ROBLOX works, or is there a way around it? |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 22 Nov 2013 10:33 PM |
| Use TweenPosition() http://wiki.roblox.com/index.php/TweenPosition_(Method) |
|
|
| Report Abuse |
|
|
mjemje
|
  |
| Joined: 28 Mar 2009 |
| Total Posts: 25787 |
|
|
| 22 Nov 2013 10:34 PM |
| I thought of that at one point, but tweening has a gui object move over a period of time. It's only after that period of time that the script will move on to tweening the next bullet, correct? |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 22 Nov 2013 10:36 PM |
| Check out the last example. I dont think so... |
|
|
| Report Abuse |
|
|
mjemje
|
  |
| Joined: 28 Mar 2009 |
| Total Posts: 25787 |
|
|
| 22 Nov 2013 10:40 PM |
Edit: This is not the case. The script does not wait for a tween to finish before moving on.
However, tweening did not make the movement any smoother. Everything's still jittery. |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2013 10:42 PM |
| (If you do want it to wait you can use the callback argument.) |
|
|
| Report Abuse |
|
|
mjemje
|
  |
| Joined: 28 Mar 2009 |
| Total Posts: 25787 |
|
|
| 22 Nov 2013 10:45 PM |
Wait for what? Wait for one bullet to tween before starting to move the next one?
No, I don't want that. |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2013 10:46 PM |
Note the IF in my sentence...
And why don't you just use Tweening... |
|
|
| Report Abuse |
|
|
mjemje
|
  |
| Joined: 28 Mar 2009 |
| Total Posts: 25787 |
|
|
| 22 Nov 2013 10:49 PM |
| Please read previous replies. I tried moving bullets via tweening; the jittering effect persisted. |
|
|
| Report Abuse |
|
|