• Advertisement

ethancodes

Member
  • Content count

    56
  • Joined

  • Last visited

Community Reputation

9 Neutral

About ethancodes

  • Rank
    Member

Personal Information

  • Interests
    Design
    DevOps
    Programming
  1. Algorithm Increasing difficulty algorithm

    Thanks for the ideas. I think this is going to be a big help.
  2. Algorithm Increasing difficulty algorithm

    Right I understand all this, my problem is I have 0 idea of how to actually implement it. I have very little experience with coming up with math equations to solve problems like this. I have started to break it down a little bit and come up with a few ideas, but I have no idea how well it's actually going to work when I start trying to implement it. I have a feeling this is just going to be massive amounts of trial and error.
  3. Algorithm Increasing difficulty algorithm

    This is an endless game though. If I give it a set a certain amount of levels it breaks the concept of almost all the other game mechanics in the game that I have designed to get people to keep playing for more than just a few days.
  4. C# 2D Collider problems

    Well..... nevermind. I seem to have got it to work. I'm not entirely sure how. I just started going through the list of stuff I'd already tried and doing it again. And now it works. lol. Must have had something wrong somewhere the first time.
  5. I'm having a weird issue with detecting a collision. I've tried everything I could find online but nothing seems to work. I have a brick object. It has a 2D Collider attached and I have also attached a 2D Rigidbody on it. I also have an EndScreen 2D Collider. The EndScreen 2D collider is tagged with "EndScreen". I am trying to detect when a brick collides with the end screen collider and simply print "game over" in the console. This is my current code for this part of the program, it is attached to the bricks: void OnCollisionEnter (Collision2D collision) { if (collision.gameObject.tag == "EndScreen") { Debug.Log("Game over"); } } Several things have happened depending on the set up. If I have the rigidbody 2D set as static, my ball object can still collide with the bricks, but I get no Log message. If I set it to Kinematic or Dynamic, I get absolutely no interaction between the ball and the bricks, and nothing when the bricks pass through the collider. I have tried to set the collider to a trigger and use OnTriggerEnter2D, no change. I have tried to put the rigidbody on the EndScreen object and tried to set it's body type to all 3 settings, no change. The only thing I can think of that I have not done is put the script on the EndScreen object and switch the tag to the bricks. The reason I have not done this is because I will have several types of bricks, some of which will have different tags. Please tell me somebody can see what I'm doing wrong here, because I'm losing my mind over something I feel should be ridiculously simple. Thanks.
  6. Algorithm Increasing difficulty algorithm

    Sounds cool. I'll do some more research into this type of thing and see what I can come up with. I'm actually not working on this part of it yet, but wanted to start getting some ideas of what to do when I get to it because I'm a bit worried it's going to be pretty difficult. I'm excited to see what I can come up with for it though. Thanks again for the help ScoutingNinja!
  7. Algorithm Increasing difficulty algorithm

    I have never heard of this before, so I just looked up some information on it. Is this something that would be feasible for a mobile game though? It sounds super complex.
  8. I'm working on an endless wave-based arkanoid/space invaders style hybrid. Bricks spawn above the screen and move down line by line. You must destroy all bricks before they hit the bottom of the screen. There will be multiple types of bricks and random power-up spawns. Currently I am just using a simple Log function that takes in the current wave as a parameter. This works to increase the number of bricks spawned each wave, but I want to find a way to make this much more complicated. Here is a list of everything that should be effected by the increase in difficulty: 1. Number of bricks 2. Types of bricks (1 hit bricks, 2 hit bricks, 3 hit bricks, etc.) 3. Speed that the bricks move down the screen 4. How often power-ups spawn The biggest problem here is that I can't just increase all of these with each new wave. If I did that, it would quickly become far to difficult. What I would like is an algorithm that gives some amount of variance in the increase between all 4 of these. Say one wave we put 60% of the increase to number of bricks, 20% increase to power-up spawns, 10% to types of bricks and 10% to speed of bricks. But on the next wave those percentages are all moved around and we now have say 105% to work with so the overall difficulty has increased as well. The different types of bricks need to also change to the point where if someone has made it to a certain wave, such as wave 50 for example, there are no longer any 1 hit bricks. We now would have just 2-4 hit bricks, and if they are crazy good and make it all the way to round 100, Now it's just 3-5 hit bricks, etc. If anybody has any good ideas or suggestions on this, I'd appreciate anything you've got! Thanks!
  9. I fixed it! It was just a stupid mistake. I had + and - 11 and not 1 when I was trying to check the bricks to the left and the right. it works perfectly now. Thanks so much Scouting Ninja for all of your help!
  10. I'm having a really hard time following your code. I don't see anywhere where you call the GetEmptyBorder method, or maybe it just gets called automatically for being attached to the script I guess. Also, what you said about checking if there is an empty row to move the lines down. How exactly is that going to work when the bricks are stacked? Would we move one row down at a time starting from the bottom row, and then just wait till all that is done to render them?
  11. [UNITY C#] Go through window.

    I think it would help you get an answer if we had some more information. What type of game is this? Is this a 3D or 2D game? Is it a point and click style game? Is clicking the e button to go through a window like an "interact" button? Have you made the animation already? If not, you'll need to make an animation to start with and then decide how you want to activate that animation.
  12. unity game developing help

    I agree with Tony Li, the scope is way too large here. I'm not sure what your requirements are for school, but I would suggest a one level game. If it's a learning game about mutation, maybe do something like one of those alchemy type games where you mix things together to see what you end up with. In this case, you could have something like a representation of a virus, and then add thing to it to mutate it. This is just a simple suggestion but I think it would be significantly easier than the action style game you are suggesting.
  13. Ok, so I believe I've got everything working correctly with the exception of checking the borders around a position. I'm getting an index out of range exception on the Checkborders method, and I think it's because of how I'm doing my math. Hoping someone can help me out with the proper way of navigating around a multidimensional array. Here is my current method: void CheckBorders (GridSquare currentPosition) { gridOptions.Clear (); //empty gridOptions list if (currentPosition.GridPosition.x != 1) { //check to make sure we are not on column 1, if not, check 1 column to the left. If available, set to gridOptions list tempPosition = gridPositions[(int)currentPosition.GridPosition.x - 11, (int)currentPosition.GridPosition.y]; if (tempPosition.IsVisible == true) { gridOptions.Add (tempPosition); } } if (currentPosition.GridPosition.x != 20) { //check to make sure we are not on column 20, if not, check 1 column to the right. If available, set to gridOptions list tempPosition = gridPositions[(int)currentPosition.GridPosition.x + 11, (int)currentPosition.GridPosition.y]; if (tempPosition.IsVisible == true) { gridOptions.Add (tempPosition); } } if (currentPosition.GridPosition.y != 16) { //check to make sure we are not on row 18, if not, check 1 row under. If available, set to gridOptions list tempPosition = gridPositions[(int)currentPosition.GridPosition.x, (int)currentPosition.GridPosition.y - 1]; if (tempPosition.IsVisible == true) { gridOptions.Add (tempPosition); } } if (currentPosition.GridPosition.y != 22) { //check to make sure we are not on row 30, if not, check 1 row up. If available, set to gridOptions list tempPosition = gridPositions[(int)currentPosition.GridPosition.x, (int)currentPosition.GridPosition.y + 1]; if (tempPosition.IsVisible == true) { gridOptions.Add (tempPosition); } } }
  14. I was able to fix one issue, just a simple case of not counting correctly when dealing with arrays. lol. But I am still getting this error: NullReferenceException: Object reference not set to an instance of an object BoardManager.AllSquaresVisible () (at Assets/Scripts/BoardManager.cs:85) BoardManager.RandomPosition () (at Assets/Scripts/BoardManager.cs:53) BoardManager.LayoutObjectAtRandom (UnityEngine.GameObject brick, Int32 brickCount) (at Assets/Scripts/BoardManager.cs:141) BoardManager.SetupScene (Int32 level) (at Assets/Scripts/BoardManager.cs:158) GameManager.InitGame () (at Assets/Scripts/GameManager.cs:27) GameManager.Awake () (at Assets/Scripts/GameManager.cs:22) UnityEngine.Object:Instantiate(GameObject) LevelManager:Awake() (at Assets/Scripts/LevelManager.cs:23) I'm not entirely sure what it's talking about?
  15. Just to show everything I'm working with right now, this is where I'm currently at: public class BoardManager : MonoBehaviour { private int columns = 20; //Number of columns in our game board. private int rows = 22; //Number of rows in our game board. Only 16 - 22 are available for brick spawning public int brickCount; //Number of bricks to spawn. //Define brick types to assign sprites to in editor public GameObject oneHitBrick; public GameObject twoHitBrick; public GameObject threeHitBrick; public GameObject explodingBarrel; //temporarily represented by the unbreakable brick private Transform boardHolder; //A variable to store a reference to the transform of our Board object. private GridSquare randomPosition; //Position at the randomIndex private GridSquare[,] gridPositions = new GridSquare[20,30]; //list of positions on game board private List<GridSquare> gridOptions = new List<GridSquare>(); //list of options to place next brick private GridSquare tempPosition; //Clears our array gridPositions and prepares it to generate a new board. void InitialiseList () { //Clear our array gridPositions. Array.Clear(gridPositions, 0, gridPositions.Length); //Loop through x axis (columns). for(int x = 0; x < columns; x++) { //Within each column, loop through y axis (rows). //start at 16 to spawn our bricks offscreen for(int y = 16; y <= rows; y++) { bool visible = true; //At each index add a new Vector3 to our array with the x and y coordinates of that position. gridPositions[x,y] = new GridSquare(new Vector3(x,y,0), visible); } } } //RandomPosition returns a random position from our gridPositions array. GridSquare RandomPosition () { if (AllSquaresVisible()) //check if all gridPositions are unoccupied { //set randomPosition to a random element in gridPositions array randomPosition = gridPositions[Random.Range(0,gridPositions.GetLength(0)),Random.Range(0,gridPositions.GetLength(1))]; //ensures the GridSquare will not be re-used randomPosition.IsVisible = false; //Return the randomly selected GridSquare return randomPosition; } //call CheckBorders to populate list gridOptions CheckBorders(randomPosition); //Calling this here is an issue right now, not sure how to fix it yet. //set randomPosition value to a random number between 0 and the count of items in our List gridOptions. randomPosition = gridOptions[Random.Range(0, gridOptions.Count)]; //make sure the chosen GridSquare can't be re-used randomPosition.IsVisible = false; //Return the randomly selected Vector3 position. return randomPosition; } //Check to see if all squares are visible private bool AllSquaresVisible () { for (int i = 0; i < gridPositions.GetLength (0); i++) { for (int j = 0; j < gridPositions.GetLength (1); j++) { if (!gridPositions [i, j].IsVisible) { return false; } } } return true; } //check borders is used to check above, below, left, and right of the current GridSquare to see if those options are available for next brick, and then each //available option is added to list gridOptions void CheckBorders (GridSquare currentPosition) { gridOptions.Clear (); //empty gridOptions list if (currentPosition.GridPosition.x != 1) { //check to make sure we are not on column 1, if not, check 1 column to the left. If available, set to gridOptions list tempPosition = gridPositions[(int)currentPosition.GridPosition.x - 11, (int)currentPosition.GridPosition.y]; if (tempPosition.IsVisible == true) { gridOptions.Add (tempPosition); } } if (currentPosition.GridPosition.x != 20) { //check to make sure we are not on column 20, if not, check 1 column to the right. If available, set to gridOptions list tempPosition = gridPositions[(int)currentPosition.GridPosition.x + 11, (int)currentPosition.GridPosition.y]; if (tempPosition.IsVisible == true) { gridOptions.Add (tempPosition); } } if (currentPosition.GridPosition.y != 18) { //check to make sure we are not on row 18, if not, check 1 row under. If available, set to gridOptions list tempPosition = gridPositions[(int)currentPosition.GridPosition.x, (int)currentPosition.GridPosition.y - 1]; if (tempPosition.IsVisible == true) { gridOptions.Add (tempPosition); } } if (currentPosition.GridPosition.y != 30) { //check to make sure we are not on row 30, if not, check 1 row up. If available, set to gridOptions list tempPosition = gridPositions[(int)currentPosition.GridPosition.x, (int)currentPosition.GridPosition.y + 1]; if (tempPosition.IsVisible == true) { gridOptions.Add (tempPosition); } } } //LayoutObjectAtRandom accepts an array of game objects to choose from along with a minimum and maximum range for the number of objects to create. void LayoutObjectAtRandom (GameObject brick, int brickCount) { //Instantiate objects until the randomly chosen limit objectCount is reached for(int i = 0; i < brickCount; i++) { //Choose a position for randomPosition by getting a random position from our list of available Vector3s stored in gridPosition Vector3 selectedPosition = RandomPosition().GridPosition; //Instantiate tileChoice at the position returned by RandomPosition with no change in rotation Instantiate(brick, selectedPosition, Quaternion.identity); } } //SetupScene initializes our level and calls the previous functions to lay out the game board public void SetupScene (int level) { //Reset our list of gridpositions. InitialiseList (); brickCount = (int)Mathf.Log(level, 2f); //set the number of bricks based on the current level //Instantiate a random number of wall tiles based on minimum and maximum, at randomized positions. LayoutObjectAtRandom (oneHitBrick, brickCount); } } public class GridSquare { public Vector3 GridPosition { get; set; } public bool IsVisible { get; set; } public GridSquare (Vector3 position, bool visible) { GridPosition = position; IsVisible = visible; } }
  • Advertisement