Hi guys
Since Clash Royale is my favorite game at the moment, I decided that it would be a good place to start developing games. Current Gameplay Demo can be found here.
So, obviously, I had absolutely NO knowledge when I started as it even pre-dated my Udemy course.
During this cycle, I have started gaining knowledge in the following:
Unity (well, obviously, but Ben’s course has helped me A LOT so far)
Blender (Yes, I have queued up the Blender Course offered by Ben as well)
Gimp
Any input and feedback would be extremely welcome at this point.
(Current actual Dev time, including 3D modelling and rigging is at about 2 weeks)
(Please excuse the horrible graphics… I am still learning and currently my core focus has been completing the core gameplay mechanic, which seems to be done now.)
Next phase:
Implementing Decks in the game
Finishing the as yet unfinished menu system (I know Ben, but the gameplay was more interesting )
Implementing Deck builder - This is what is making the menu system a requirement.
Multiplayer (I am currently powering through the Unity GameDev Course, Zombie Runner specifically to get to the multiplayer stuffs)
Hi Paul!
Very nice so far. I would be interested if you would share any of your code or just explain how you did specific things? I would like to know how you solved that you can actually can drag the UI cards and place them as 3d models in the scene just like in clash Royale?
Greetings
Hi Max
I would be more than willing to share code etc as requested.
Regarding the dragging and dropping, the short answer is that I created 2 scripts to do this:
DragHandler
This script handles the OnDrag, OnBeginDrag and OnEndDrag methods (Standard drag and drop stuffs)
DropHandler
This script handles the OnDrop methods (Standard drag and drop stuffs)
The key is converting mouse input positions to positions within the 3d environment:
//get position we are dragging on in game world
Ray camRay = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit positionHit;
if (Physics.Raycast(camRay, out positionHit, camRayLength, floorMask))
{
// Debug.Log ("Mouse: " + Input.mousePosition + ", Ray: " + positionHit.point);
newPosition = positionHit.point;
}
this.gameObject.transform.position = newPosition;
unitToSpawn.transform.position = newPosition;
Once you have the 3d world location, its as simple as instantiating the required 3d object at that location.
I am more than willing to share my entire DragHandler and DropHandler if you are interested?
FloorMask is an int containing the index of the layer you are trying to cast to (in my case, LayerMask.GetMask(“Floor”), where I Linked the floor of the arena to a “Floor” layer
camRayLength is the distance you are allowed to cast. I am using 100f. If the raycast does not hit floor within 100f units, it will not return a hit
The reason I have 2 objects whose transform.position I set to NewPosition is that at present, I am also moving a copy of the card being dragged along with the 3d object. I do this as I only want to start displaying the 3d object once it is within acceptable dropping bounds. Till then, the player only sees the card being dragged.
I use the DragHandler on objects that need to be dragged (The image of the card being dragged)
I use the DropHandler on the object container from which is being dragged.
I suppose I could use Drag and Drop handler both on the same object, but I need to play with that to confirm.
Wow, sounds easy but I think I would never guess how I could implement it that way. I failed too many times to achieve what you did just like in the original.
Well, I am definitely interested! Can I contact you somehow, for example by email? I think it would be more comfortable.