Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jul 12, 2011 at 05:54 PM by Chris D for the following reason:

Answer given, discussion keeps bumping to top of queue.

avatar image
0
Question by Shealei · Jul 12, 2011 at 02:23 PM · tetrisrng

Making a Tetris. Help needed on; Making blocks stop at a certain coodinate so they dont go outside the camera view!

Hi people, hello again. I've been making my tetris but these are the two problems i really couldnt handle.

To explain the terrain:

I have a 80x160 board with a cube combinations that have 0.1 dept and 8 with and height per square. So this cube looks 2D from my camera and moves around freely. The rectangle board 80x160(Background) is about %30-35 of the screen and i will put score and stuff on right and left later.

1st Problem; Ok so i want my cubes to stop at the edges of the background. What i mean by that, at tetris when you go with the cube to farthest left, it stops going left. At right it stops going right, but you can still move it to other directions. I want to do that with a command like, "Disable left movement when cube is on bla bla coordinates or something". I can make a distance fucntion to stop movement, but " update() dist " is a very heavy function and i cant use that in every game i make. I want to learn the right way to do it with some kind of a coordinate variable.

2nd Problem;

a)How do i spawn new blocks with RNG.

b)How do i make sure i spawn one block when the other collides.(Probably with onCollisionEnter but still i wanted to ask)

As for the RNG and Spawning combination i have no idea whatsoever so i need help on that. I havent tried collision problem yet but i want to confirm if its true before wasting some large time.

I want to make the blocks rigidBodies that are unable to rotate or move to any axis(I'll move them with codes, i dont want any recoil when they collide). And when they collide with the terrain or any other block or Prefab replacement(There are four of them "L shape, T shape, I shape, CUBE shape blocks), they will be deleted and replaced with a Prefab(via Instantiate) that is also a rigidbody that is unable to move(or a kinematic body) with a diffrent texture and some light effects. And when this collides a new block will spawn. I'll spawn the first block with function Start() and others with onCollisionEnter.

On some tetrises that are things like, "NEXT BLOCK INCOMING SIGN ON THE RIGHT, BONUS COMBOS FOR PONTS, A VISABLE PATH GOING DOWN SHOWING WHERE THE BLOCK WILL LAND"

Like this : http://www.ressim.net/i/4627443

I'd really want to have an idea how to make them. Dont give me entire codelines, i am making a tetris to learn. Give me the ideas and main script names, i'll go on from there.

So are my ideas right, and how can i solve my questions. Any help is appriciated guys. PLEASE ANSWER IN JAVASCRIPT, i have "0" knowledge of C. Love you all...

Comment
Add comment · Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Chris D · Jul 12, 2011 at 04:03 PM 0
Share

There must be a half-dozen questions in there. This site is meant to help with specific issues not "how do I make this game"-scale issues.

Break it down, give it a try, keep it to one question per thread and you're going to get better results.

avatar image Shealei · Jul 12, 2011 at 04:31 PM 0
Share

Actually there are only 2 questions here :). I just want 2 answers and some ideas. If you answer one of them, the 1st one which is the most dire at the moment i would be happy.

avatar image SilverTabby · Jul 12, 2011 at 04:36 PM 1
Share

I was/am making a tetris game and my advice is:

$$anonymous$$ake a script that handles all of the tetris logic/moving around/etc internally (using a 2d array?)

When you are done with that, THEN display it in the world (I'm outputting using GUI.Box at the moment).

Basically: I think you are working backwards. You are trying to output your results before you have created the back-end to create them.

avatar image Chris D · Jul 12, 2011 at 05:50 PM 1
Share

(almost) everything you need is in the scripting reference. Once you know what the functions are called (which will come from reading up/tutorials/looking at other people's code) it's all there, written in plain english. Personally, I keep the scripting reference open at all times when I'm coding. Understanding what that code is doing is paramount. Only then can you translate the logic you have in your $$anonymous$$d back into writable code.

For general discussions/general pointers, the forums are a better venue (every comment we make on this now-solved thread bumps it back to the top of the queue) and I suggest trying them.

For now, I'm closing this thread as I don't see a better answer co$$anonymous$$g for your question than what Eric has supplied. If you have further, specific problems, just open a new question.

avatar image Eric5h5 · Jul 12, 2011 at 07:29 PM 1
Share

@Shealei: it's just practice. If you understand 40% of the code, then you're better off than I was when I started. At the time, pretty much the only thing that existed was the first-person shooter tutorial for Unity 1.x, and I understood maybe 5% of the code. I had to look stuff up in the docs for literally every single line of code that I wrote. Just practice.

Show more comments

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by Eric5h5 · Jul 12, 2011 at 04:39 PM

An example of Tetris in Unity is here.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

keyboard settings 1 Answer

Sphere cast thing help please!!!! 1 Answer

Using EditorGUI.FloatField With Custom Class Inspectors? 1 Answer

animation help with falling when not grounded? 0 Answers

How make an Interaction with object like the last of us? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges