{"author_name":"Geckoo1337","cat":"LD #33","comments":[],"epoch":1437322140,"likes":1,"metadata":{"p_key":"17155","p_author":"Geckoo1337","p_authorkey":"35835","p_urlkey":"52456","p_title":"UltraFlow Clone","p_cat":"LD #33","p_event":"LD32","p_time":"1437322140","p_likes":"1","p_comments":"0","p_status":"UPD5","us_key":"35835","us_name":"Geckoo1337","us_username":"\/author\/geckoo1337\/","event_start":"1429228800","event_key":"27","event_name":"LD32"},"text":"<p>For those who have tested and liked the game UltraFlow, I wanna show a little project which I did recently so as to increase my understanding about some physics on Unity 5. These scripts allow me to generate some sprites with behavior so as to create all obstacles and more. For the physics on the bullet, I use a drag&amp;drop script. This way the project works fine on mobile device and WebPlayer. It&#8217;s an alpha, but you can see the first steps on screen. I think that it&#8217;s good enough. Try it if you want. See you later for the next Ludum Dare session&#8230;<\/p>\n <p>I would like to know your point of view ++<\/p>\n <p><a href=\"http:\/\/jeparlerusse.fr\/test\/Test.html\">UltraFlow Clone<\/a><\/p>\n <p><a href=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/07\/UltraFlow.jpg\"><img class=\"alignnone size-full wp-image-470428\" src=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/07\/UltraFlow.jpg\" alt=\"UltraFlow\" width=\"500\" height=\"500\" srcset=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/07\/UltraFlow-150x150.jpg 150w, http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/07\/UltraFlow-300x300.jpg 300w, http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2015\/07\/UltraFlow.jpg 500w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n <p>When the bullet is blocked near of a corner, you can attract it to the center by using the C key :<\/p>\n <p>void Update() {<br \/>\n #if UNITY_STANDALONE || UNITY_WEBPLAYER<br \/>\n \/\/ enables\/disables the epicenter force field so as to attract bullet to the screen center<br \/>\n if (Input.GetKeyDown (KeyCode.C)){<br \/>\n if (_epicenter == false)<br \/>\n _epicenter = true;<br \/>\n else<br \/>\n _epicenter = false;<br \/>\n }<br \/>\n #endif<br \/>\n \/\/ point base so as to define where is the bullet<br \/>\n Vector3 viewPos = _camera.WorldToViewportPoint(target.position);<br \/>\n var vm = target.gameObject.GetComponent&lt;Rigidbody2D&gt;().velocity.magnitude;;<br \/>\n \/\/ limits velocity &#8211; more or less<br \/>\n if (vm &gt;= 5.0f)<br \/>\n vm = 5.0f;<br \/>\n if (vm &lt;= 2.0f)<br \/>\n vm = 2.0f;<br \/>\n \/\/ adds a force on the bullet so as to create a force field<br \/>\n if (_epicenter){<br \/>\n if (viewPos.x &gt; 0.5f)<br \/>\n target.gameObject.GetComponent&lt;Rigidbody2D&gt;().AddForce(-Vector2.right * vm);<br \/>\n if (viewPos.x &lt; 0.5f)<br \/>\n target.gameObject.GetComponent&lt;Rigidbody2D&gt;().AddForce(Vector2.right * vm);<br \/>\n if (viewPos.y &gt; 0.5f)<br \/>\n target.gameObject.GetComponent&lt;Rigidbody2D&gt;().AddForce(-Vector2.up * vm);<br \/>\n if (viewPos.y &lt; 0.5f)<br \/>\n target.gameObject.GetComponent&lt;Rigidbody2D&gt;().AddForce(Vector2.up * vm);<br \/>\n }<br \/>\n }<\/p>","time":"July 19th, 2015 11:09 am","title":"UltraFlow Clone"}