Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Help with game similar to Monster Rancher Explorer

Discussion in '2D' started by hunter2379, Oct 29, 2015.

  1. hunter2379

    hunter2379

    Joined:
    Feb 2, 2014
    Posts:
    13
    So I'm messing around and want to make something like Monster Rancher Explorer for the Gameboy Color.
    Link to Monster Rancher Explorer GamePlay:


    Basically, I have my guy moving around a small area and jumping. The jump isn't like the game and I wanna work on that eventually. My main concern right now is how to spawn the boxes.

    I was planning to use instantiate but I need a way to snap it to the unity grid and for the player not to be able to instantiate if there is already a box in that spot.

    Instantiate code I have: Instantiate(box,new Vector3(this.transform.position.x+1f, this.transform.position.y, 0), Quaternion.identity);//Spawn box to the right side

    Any ideas?
     
  2. VorpalSilence

    VorpalSilence

    Joined:
    Oct 22, 2015
    Posts:
    13
    In terms of snapping to the unity grid; if you ensure that your box texture image is a square image (power of 2's are good, like 32x32, 64x64 etc) you can then set the pixels per unit in the textures inspector window to its resolution. So if its a 32x32 texture, set it so that 32 pixels is one unity unit. Then when it is spawned it will take up exactly one unit. (You can of course make it half of a unit per box or whatever works for your project.)

    As for the player not spawning if there is a box, in the simplest terms you can spawn the player at a specific point and ensure that you never also spawn a box in that spot. Otherwise there are many ways to approach this issue. A fairly normal way to approach it would be to keep an array that represents what is spawned in the level and check to see what is in the position that you want to spawn the player at before doing so.

    Hope that helps!
     
  3. hunter2379

    hunter2379

    Joined:
    Feb 2, 2014
    Posts:
    13
    I'm using the default unity grid so my sprites are 100x100. But say my sprite is at position .3f,1f,0f and I press left control, I want the brick to spawn at 1.5f,1f,0f.