generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

uses for OOP in ROBLOX?

Previous Thread :: Next Thread 
UDizzle is not online. UDizzle
Joined: 21 Nov 2015
Total Posts: 24
26 Nov 2015 09:26 PM
some uses so I can practice?
Report Abuse
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
26 Nov 2015 09:29 PM
Scripting

Report Abuse
sonicboy01 is not online. sonicboy01
Joined: 22 Nov 2008
Total Posts: 923
26 Nov 2015 09:30 PM
Open a piece of code then smash your face into the keyboard. Then bam! You learn it. (Yes this is off that ad)
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
26 Nov 2015 09:32 PM
OOP makes things easier if you're running a large scale project.

I don't know, make a player wrapper or something that presents the hierarchy in a less complicated way (especially with the character).
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
26 Nov 2015 10:16 PM
Whats OOP



Instance.new("BodyVelocity",SenseiWarrior).velocity = CFrame.new(SenseiWarrior.Torso.Position,YourGirlsDMs.Position).lookVector * 10
Report Abuse
crazyman32 is online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
26 Nov 2015 11:43 PM
Here's a few from a game I'm making:

> Tween
local tween = Tween.new(1, "InOutQuad", function(ratio) ... end)
tween:Run()
tween.Finish:wait()

> Snowball
local snowball = Snowball.new(player)
snowball:Throw()

> ListenerList
local listeners = ListenerList.new()
listeners:Connect(button.MouseButton1Click, function() ... end)
listeners:Connect(part.Touched, function(part) ... end)
listeners:DisconnectAll()


As you can see, creating Objects for your game allows you to encapsulate a lot of game logic into nice modules. For instance, with my Snowball object, all I have to do is create a Snowball object and then call Throw. Behind the scenes, the Snowball object does a lot of work to accomplish what needs to happen.

Proper OOP in Lua also saves you memory. With the uses of metatables, you can have hundreds of objects that use the same set of functions (not duplicates), but each method call can still refer to the correct object. For instance, in my game, I can have nearly 500 NPCs roaming around. Instead of having 500 duplicates of functions/methods, they all share the same set of methods.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Nov 2015 11:48 PM
Almost everything you do that is Roblox-related is OOP.
part.BrickColor (inheritance) = blah
part:Destroy() (again)
Report Abuse
UDizzle is not online. UDizzle
Joined: 21 Nov 2015
Total Posts: 24
26 Nov 2015 11:49 PM
@crazyman32

that's awesome, thanks for the information

after learning how to set up basic OOP and some concepts around it, the next step for me would be to apply it to my own scripting, and your response definitely helped me understand more about the uses for OOP and how i can apply it to my own games.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image