SHOW:
|
|
- or go back to the newest paste.
1 | -- imagine naming a script mainAPI when its not even an api but actually using one | |
2 | -- :thonk: | |
3 | local RunService = game:GetService("RunService") | |
4 | local contentBro = game:GetService("ContentProvider") | |
5 | local player = game.Players.LocalPlayer | |
6 | local mouse = player:GetMouse() | |
7 | local inGame = false | |
8 | local debounce = false | |
9 | local ts = game:GetService("TweenService") | |
10 | local dead = false | |
11 | local objectDict = { | |
12 | [script.Parent.background.ThreeCactusSmall] = 0.45, | |
13 | [script.Parent.background.TwoCactus] = 0.45, | |
14 | [script.Parent.background.OneCactus] = 0.1 | |
15 | } | |
16 | local objects = {} | |
17 | for obj in pairs(objectDict) do | |
18 | table.insert(objects, obj) | |
19 | end | |
20 | contentBro:PreloadAsync(objects) | |
21 | local dinosaur = script.Parent.background.dinosaur | |
22 | local uis = game:GetService("UserInputService") | |
23 | mouse.Icon = "rbxassetid://3313572053" | |
24 | ||
25 | local objectTable = {} | |
26 | ------------------ ok now stuff that doesnt matter in the fucking slightest ------------------------ | |
27 | ||
28 | script.Parent.onlyinteractable.MouseEnter:Connect(function() | |
29 | mouse.Icon = "rbxassetid://3313510115" | |
30 | end) | |
31 | script.Parent.onlyinteractable.MouseLeave:Connect(function() | |
32 | mouse.Icon = "rbxassetid://3313572053" | |
33 | end) | |
34 | local pls = {true} | |
35 | local t = 3 | |
36 | uis.InputBegan:Connect(function(inp,gpe) | |
37 | if (inp.KeyCode == Enum.KeyCode.Space or inp.UserInputType == Enum.UserInputType.Touch) and not gpe and not inGame then | |
38 | inGame = true | |
39 | debounce = true | |
40 | dinosaur.Position = UDim2.new(0.001, 0, 0.55, 0) | |
41 | script.Parent.urdeadlol.Visible = false | |
42 | dinosaur.Image = "rbxassetid://3314227620" | |
43 | script.Parent.barrier1.Position = UDim2.new(0.689, 0, 0.542, 0) | |
44 | for i, obj in pairs(objectTable) do | |
45 | table.remove(objectTable, i) | |
46 | obj:Destroy() | |
47 | end | |
48 | script.Parent.background.score.Text = "00000" | |
49 | local function aa() | |
50 | script.Parent.badboy.Position = UDim2.new(0.667, 0, 0.542, 0) | |
51 | - | script.Parent.badboy:TweenPosition(script.Parent.badboy.Position - UDim2.new(0, script.Parent.badboy.AbsoluteSize.X, 0, 0), Enum.EasingDirection.Out,Enum.EasingStyle.Linear,3,false,aa) |
51 | + | script.Parent.badboy:TweenPosition(script.Parent.badboy.Position - UDim2.new(0, script.Parent.badboy.AbsoluteSize.X, 0, 0), Enum.EasingDirection.Out,Enum.EasingStyle.Linear,t,false,aa) |
52 | end | |
53 | aa() | |
54 | dinosaur:TweenPosition(UDim2.new(0.001, 0,0.1, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.3) | |
55 | wait(.31) | |
56 | ||
57 | dinosaur:TweenPosition(UDim2.new(0.001, 0,0.55, 0),Enum.EasingDirection.In,Enum.EasingStyle.Quad,.2) | |
58 | wait(.2) | |
59 | script.Parent.barrier1:TweenPosition(UDim2.new(0.92, 0,0.542, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1) | |
60 | wait(.5) | |
61 | dinosaur:TweenPosition(UDim2.new(0.021, 0,0.55, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Linear,.2) | |
62 | ||
63 | debounce = false | |
64 | spawn(function() | |
65 | while inGame and not dead do | |
66 | dinosaur.Image = "rbxassetid://3314873926" | |
67 | wait(.1) | |
68 | if dead then break end | |
69 | dinosaur.Image = "rbxassetid://3314873718" | |
70 | wait(.1) | |
71 | ||
72 | end | |
73 | end) | |
74 | ||
75 | spawn(function() | |
76 | while not dead do | |
77 | script.Parent.background.score.Text = string.format("%05.f", tonumber(script.Parent.background.score.Text) + 1) | |
78 | wait(0.1) | |
79 | end | |
80 | end) | |
81 | ||
82 | dead = false | |
83 | local collidedWith | |
84 | ||
85 | local hm = false | |
86 | local a = 0 | |
87 | while not dead and pls[1] do | |
88 | if a % 10 == 0 then t = math.clamp(t, 1, 3) end | |
89 | a = (a + 1) % 10 | |
90 | local object | |
91 | local nani = math.random() -- nani?! | |
92 | --if nani == 1 or nani == 2 and not dead then print("goofy goober") | |
93 | if not dead then print("goofy goober") | |
94 | --[[local original = script.Parent.background.TwoCactus | |
95 | object = original:Clone() | |
96 | object.Position = original.Position | |
97 | object.Parent = script.Parent.Parent.background | |
98 | elseif nani == 2 then]] | |
99 | --local original = script.Parent.background.ThreeCactusSmall | |
100 | local s = 0 | |
101 | local original | |
102 | for object, chance in pairs(objectDict) do | |
103 | if nani >= s and nani < s + chance then | |
104 | original = object | |
105 | break | |
106 | end | |
107 | s = s + chance | |
108 | end | |
109 | --object = script.Parent.background.ThreeCactusSmall:Clone() | |
110 | object = original:Clone() | |
111 | object.Position = original.Position | |
112 | object.Parent = script.Parent.background | |
113 | ||
114 | object:TweenPosition(UDim2.new(-0.2, 0,object.Position.Y.Scale,0),Enum.EasingDirection.In,Enum.EasingStyle.Linear,(object.Parent.AbsoluteSize.X * (0.2 + object.Position.X.Scale))/(script.Parent.badboy.AbsoluteSize.X/t), true) | |
115 | table.insert(objectTable, object) | |
116 | ||
117 | local collisionConnection | |
118 | collisionConnection = RunService.Heartbeat:Connect(function() | |
119 | if dinosaur.AbsolutePosition.X <= object.AbsolutePosition.X + object.AbsoluteSize.X and | |
120 | dinosaur.AbsolutePosition.X + dinosaur.AbsoluteSize.X >= object.AbsolutePosition.X and | |
121 | dinosaur.AbsolutePosition.Y <= object.AbsolutePosition.Y + object.AbsoluteSize.Y and | |
122 | dinosaur.AbsolutePosition.Y + dinosaur.AbsoluteSize.Y >= object.AbsolutePosition.Y then | |
123 | collisionConnection:Disconnect() | |
124 | print("epic gamer collision") | |
125 | collidedWith = object | |
126 | for i, obj in pairs(objectTable) do | |
127 | if obj ~= collidedWith then | |
128 | table.remove(objectTable, i) | |
129 | obj:Destroy() | |
130 | end | |
131 | end | |
132 | object:TweenPosition(object.Position,Enum.EasingDirection.In,Enum.EasingStyle.Linear,2.5, true) | |
133 | dinosaur:TweenPosition(dinosaur.Position,Enum.EasingDirection.In,Enum.EasingStyle.Quad,.2,true) | |
134 | script.Parent.badboy:TweenPosition(script.Parent.badboy.Position,nil,nil,0,true) | |
135 | script.Parent.urdeadlol.Visible = true | |
136 | dinosaur.Image = "rbxassetid://3315457212" | |
137 | pls[1] = false | |
138 | pls[2] = true | |
139 | hm = true | |
140 | dead = true | |
141 | inGame = false | |
142 | end | |
143 | end) | |
144 | local sum = 0 | |
145 | while sum <= 1.5 do | |
146 | if hm then | |
147 | hm = false | |
148 | for i, obj in pairs(objectTable) do | |
149 | if obj ~= collidedWith then | |
150 | table.remove(objectTable, i) | |
151 | obj:Destroy() | |
152 | end | |
153 | end | |
154 | end | |
155 | sum = sum + RunService.Heartbeat:Wait() | |
156 | end | |
157 | coroutine.resume(coroutine.create(function() | |
158 | wait((object.Parent.AbsoluteSize.X * (0.2 + object.Position.X.Scale))/(script.Parent.badboy.AbsoluteSize.X/t)) | |
159 | if not dead then | |
160 | collisionConnection:Disconnect() | |
161 | object:Destroy() | |
162 | end | |
163 | end)) | |
164 | end | |
165 | end | |
166 | table.remove(pls, 1) | |
167 | ||
168 | end | |
169 | end) | |
170 | ||
171 | local debounce2 | |
172 | uis.InputBegan:Connect(function(inp,gpe) | |
173 | if (inp.KeyCode == Enum.KeyCode.Space or inp.UserInputType == Enum.UserInputType.Touch) and not gpe and inGame and not debounce2 and not dead then | |
174 | debounce2 = true | |
175 | script.Parent.Parent.jump:Play() | |
176 | dinosaur:TweenPosition(UDim2.new(dinosaur.Position.X.Scale, 0,0.1, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.3,true) | |
177 | wait(.31) | |
178 | if not dead then | |
179 | dinosaur:TweenPosition(UDim2.new(dinosaur.Position.X.Scale, 0,0.55, 0),Enum.EasingDirection.In,Enum.EasingStyle.Quad,.2,true) | |
180 | wait(.21) | |
181 | end | |
182 | debounce2 = false | |
183 | ||
184 | end | |
185 | ||
186 | end) | |
187 | --[[while true do | |
188 | wait() | |
189 | while inGame == true do | |
190 | wait() | |
191 | script.Parent.background:TweenPosition(UDim2.new(-1.234, 0,0.542, 0),Enum.EasingDirection.In,Enum.EasingStyle.Linear,3) | |
192 | wait(3) | |
193 | script.Parent.background.Position = UDim2.new(0.667, 0,0.542, 0) | |
194 | end | |
195 | end | |
196 | ]] |