Most efficient method for reusing gameplay code

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I’m looking to achieve the most efficient code possible given my game concept.

  2. What is the issue? So in my game there are 4 football fields as shown:

I have a script that works for Field 1, however I’m looking for the most efficient method to make this work for all fields. This is my second remake of this game and in the original version we just set variables for the axis local axis = "X" and used that to get the position needed (Football.Position[axis]).

This worked mostly fine, except it looked weird…

The spots on field 2 would need to be flipped. Currently, if you’re on the 3 spots on the left that don’t have the big pad next to them, those people are supposed to start with the ball on the left side of the field at the 20 yard line when the game begins. This doesn’t actually happen though, as when it’s on the other field the ball is spawned on the right side at the 20. And I want the game to be oriented the same way the field is (if Field2 is oriented 180 degrees, gameplay should be oriented 180 degrees to match that)

Any suggestions on how I might be able to achieve this?

If you have any questions feel free to ask!

1 Like

You can use module scripts, or functions.

1 Like