×

Langue

Fermer
Atelier 801
  • Forums
  • Dev Tracker
  • Connexion
    • English Français
      Português do Brasil Español
      Türkçe Polski
      Magyar Română
      العربية Skandinavisk
      Nederlands Deutsch
      Bahasa Indonesia Русский
      中文 Filipino
      Lietuvių kalba 日本語
      Suomi עברית
      Italiano Česky
      Hrvatski Slovensky
      Български Latviešu
      Estonian
  • Langue
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Script] Portal Gun
« ‹ 2 / 3 › »
[Script] Portal Gun
Violetsea
« Citoyen »
1388255340000
    • Violetsea#0000
    • Profil
    • Derniers messages
#21
  0
Where do you play in tribe house? of course? c:
#1 on second page c:
Mikuhl
« Citoyen »
1389479160000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#22
  0
Updated. Portals now instantly go to the nearest wall.
Jordy
« Consul »
1389486960000
    • Jordy#0015
    • Profil
    • Derniers messages
    • Tribu
#23
  0
Fantastic, well done!
Maxxzinnn
« Citoyen »
1389498480000
    • Maxxzinnn#0000
    • Profil
    • Derniers messages
    • Tribu
#24
  0
Wow, now it looks awesome, nice job.
Evilsantah
« Citoyen »
1389527040000
    • Evilsantah#0000
    • Profil
    • Derniers messages
#25
  0
a dit :
for t = 0, math.huge

rly jack, rly? I hadn't seen this before but basically you're just faking each frame until you have a colission with the grounds? No wonder it's pretty unresponsive :D

There's math formulae to calculate "future" colission points y'know ):
Hakureimouse
« Citoyen »
1389533040000
    • Hakureimouse#0000
    • Profil
    • Derniers messages
    • Tribu
#26
  0
Evilsantah a dit :
There's math formulae to calculate "future" colission points y'know ):

I'm interested in this
-

btw I think you should do a minigame from this if you can achieve even better speed/responsiveness, I showed this to some people and they seemed to love it :)
Mikuhl
« Citoyen »
1389536340000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#27
  0
I put everything in a table now instead of requesting it each time and its much more responsive. You can basically spam it and it wont crash unless you click REALLY fast. Ill keep the timer though.

Before you couldnt even click twice without it crashing so I believe thats much more responsive than before.
Hakureimouse
« Citoyen »
1389536760000
    • Hakureimouse#0000
    • Profil
    • Derniers messages
    • Tribu
#28
  0
Jaackster a dit :
I put everything in a table now instead of requesting it each time and its much more responsive. You can basically spam it and it wont crash unless you click REALLY fast. Ill keep the timer though.

Before you couldnt even click twice without it crashing so I believe thats much more responsive than before.

Yup I tried it already, that was a huge improvement

I did a little bit of research about what Santah said and I think something like this could be implemented. If you don't mind I'll do some test with that.
Mikuhl
« Citoyen »
1389537240000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#29
  0
Hakureimouse a dit :
Yup I tried it already, that was a huge improvement

I did a little bit of research about what Santah said and I think something like this could be implemented. If you don't mind I'll do some test with that.

If you can find out how to make sense of that, go ahead. I am the worst at understanding math.
Evilsantah
« Citoyen »
1389549000000
    • Evilsantah#0000
    • Profil
    • Derniers messages
#30
  0
Evilsantah a dit :

-- Function to determine where two lines (each based on 2 points) collide.
-- Ported from C to LUA
function linesIntersect(x1, y1, x2, y2, x3, y3, x4, y4)
local a1 = y2 - y1
local b1 = x1 - x2
local c1 = x2 * y1 - x1 * y2

-- Compute r3 and r4
local r3 = a1 * x3 + b1 * y3 + c1
local r4 = a1 * x4 + b1 * y4 + c1

-- Check signs of r3 and r4. If both point 3 and point 4 lie on
-- same side of line 1, the line segments do not intersect.

if r3 ~= 0 and r4 ~= 0 and math.sign(r3) == math.sign(r4) then
return nil -- DONT_INTERSECT
end

-- Compute a2, b2, c2

local a2 = y4 - y3
local b2 = x3 - x4
local c2 = x4 * y3 - x3 * y4

-- Compute r1 and r2

local r1 = a2 * x1 + b2 * y1 + c2
local r2 = a2 * x2 + b2 * y2 + c2

-- Check signs of r1 and r2. If both point 1 and point 2 lie
-- on same side of second line segment, the line segments do
-- not intersect.
if r1 ~= 0 and r2 ~= 0 and math.sign(r1) == math.sign(r2) then
return nil -- DONT_INTERSECT
end

-- Line segments intersect: compute intersection point.

local denom = a1 * b2 - a2 * b1
if denom == 0 then
return nil -- COLLINEAR
end
local offset = 0
if denom < 0 then offset = -denom / 2 else offset = denom / 2 end

-- The denom/2 is to get rounding instead of truncating. It
-- is added or subtracted to the numerator, depending upon the
-- sign of the numerator.

local num = b1 * c2 - b2 * c1
local x = 0
if num < 0 then x = num - offset else x = num + offset end
x = x / denom

num = a2 * c1 - a1 * c2
local y = 0
if num < 0 then y = num - offset else y = num + offset end
y = y / denom

return x, y
end

-- Function to determine where the line between (x1,y1) and (x2,y2) collide a rectangle
function lineIntersectsRect(x1, y1, x2, y2, leftTopX, leftTopY, rightBottomX, rightBottomY)
local angle1 = math.atan2(y2 - y1, x2 - x1)
local angleTLC = math.atan2(y2 - leftTopY, x2 - leftTopX)
local angleTRC = math.atan2(y2 - leftTopY, x2 - rightBottomX)
local x = nil
local y = nil
if angle1 < angleTLC then -- left edge
x, y = linesIntersect(x1, y1, x2, y2, leftTopX, rightBottomY, leftTopX, leftTopY)
if x ~= nil then
x = x + 30 -- this is just a custom offset to place the point a bit inside the rectangle
end
elseif angle1 > angleTLC and angle1 < angleTRC then -- top edge
x, y = linesIntersect(x1, y1, x2, y2, leftTopX, leftTopY, rightBottomX, leftTopY)
if x ~= nil then
y = y + 35
end
else -- right edge
x, y = linesIntersect(x1, y1, x2, y2, rightBottomX, leftTopY, rightBottomX, rightBottomY)
if x ~= nil then
x = x - 30
end
end
return x, y
end

Used this in #cannonjump, both can come in handy for this :)

E: you might want to add another case where the angle is between left bottom and right bottom (bottom edge) in lineIntersectsRect as I didn't need this.
Animaljamvid
« Citoyen »
1390770300000
    • Animaljamvid#0000
    • Profil
    • Derniers messages
    • Tribu
#31
  0
i tried it out in my tribehouse it was so fun there were just portals flying everywere X3
Grimrice
« Citoyen »
1390940520000
    • Grimrice#0000
    • Profil
    • Derniers messages
    • Tribu
#32
  0
Evilsantah a dit :
Used this in #cannonjump, both can come in handy for this :)

E: you might want to add another case where the angle is between left bottom and right bottom (bottom edge) in lineIntersectsRect as I didn't need this.

## Init Error : Ediz.lua:274: [string "Grimrice.lua"]:44: 'then' expected
## [Grimrice] Lua script loaded in 0 ms (4000 max)
Sisterofpuga
« Citoyen »
1390957440000
    • Sisterofpuga#0000
    • Profil
    • Derniers messages
    • Tribu
#33
  0
wait where do i play?
Gamegamerlol
« Citoyen »
1390961640000
    • Gamegamerlol#0000
    • Profil
    • Derniers messages
    • Tribu
#34
  0
Sisterofpuga a dit :
wait where do i play?

You can play it in your tribe house:
If you have the ability to use the /np command
If you have more than 1000 cheese
and if you haven't been banned for hacking

You just have to copy and paste the script from the OP and do /lua and paste the script in it.
Sisterofpuga
« Citoyen »
1391041380000
    • Sisterofpuga#0000
    • Profil
    • Derniers messages
    • Tribu
#35
  0
Thank You
Mikuhl
« Citoyen »
1391044080000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#36
  0
Grimrice a dit :
## Init Error : Ediz.lua:274: [string "Grimrice.lua"]:44: 'then' expected
## [Grimrice] Lua script loaded in 0 ms (4000 max)

That wasnt supposed to do anything, it was just an example of intersection checking.
Evilsantah
« Citoyen »
1391081820000
    • Evilsantah#0000
    • Profil
    • Derniers messages
#37
  0
Grimrice a dit :
## Init Error : Ediz.lua:274: [string "Grimrice.lua"]:44: 'then' expected
## [Grimrice] Lua script loaded in 0 ms (4000 max)

It contains some &lt; and &rt; perhaps, just replace those with < and >. But yeah it doesn't do anything on its own.
Lolzermp
« Citoyen »
1392433140000
    • Lolzermp#0000
    • Profil
    • Derniers messages
#38
  0
how do i even use it? ... ... im a noob at this stuff sorry just asking please dont get mad ... dont even know how to use it ... like put it on or what?
Pyrospower
« Citoyen »
1398857340000
    • Pyrospower#0000
    • Profil
    • Derniers messages
#39
  0
Jaackster a dit :
Portal Gun! Click anywhere to shoot.

EDIT: Updated. Portals now instantly spawn on the nearest wall. With the help of Izstas making the line look nice.

http://pastebin.com/raw.php?i=CvdZMDyw
NEW: http://pastebin.com/raw.php?i=CvdZMDyw

OLD: http://pastebin.com/raw.php?i=qibZXAV3

For the URL
Lullshare
« Citoyen »
1401759180000
    • Lullshare#0000
    • Profil
    • Derniers messages
#40
  0
It look like fun, i play with my friend :D it very fun!
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Script] Portal Gun
« ‹ 2 / 3 › »
© Atelier801 2018

Equipe Conditions Générales d'Utilisation Politique de Confidentialité Contact

Version 1.27