DEV Community

angeljrp
angeljrp

Posted on

Problem Solved!!

Hey everyone!

I'm back with an exciting update on my internship journey into the realm of game development! Thanks to the incredible support from my peers and some invaluable feedback, I've managed to overcome the pesky error that had been hindering my progress. It's amazing what a fresh perspective and a collaborative spirit can achieve!

During one of our team meetings, I received some fantastic suggestions for refining the mechanics of my space-themed math game. One of the most significant pieces of feedback was to allow the players more freedom of movement within the game. Instead of restricting them to simple up-and-down motions, I revamped the gameplay to enable players to navigate their spacecraft freely across the screen. This not only enhances the gameplay experience but also adds an extra layer of excitement and challenge.

Another insightful suggestion was to modify the interaction with the floating numbers in the game. Rather than having the numbers collected from a distance, the feedback emphasized making the collection mechanic more intuitive and engaging. As a result, I adjusted the game mechanics so that players now have to directly touch the numbers with their spacecraft to collect them. This subtle tweak adds a tactile element to the gameplay, making it more immersive and enjoyable.

Now, let's talk about the changes I made to the code. Here's an overview of the modifications:

this was the code used for the free-movement mechanic

public void OnDrag(PointerEventData eventData)
    {
        Vector3 mousePosition = eventData.position;
        transform.position = mousePosition;
    }

    private Vector3 offset;

    void OnMouseDown()
    {
        offset = transform.position - GetMousePosition();
    }

    void OnMouseDrag()
    {
        transform.position = GetMousePosition() + offset;
    }

    Vector3 GetMousePosition()
    {
        return Camera.main.ScreenToWorldPoint(Input.mousePosition);
    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Number")
        {
            objectCollidedWith = collision.gameObject;
            PickUp();
        }
    }
Enter fullscreen mode Exit fullscreen mode

and this is the one for picking up the numbers



public void PickUp()
    {      


            Destroy(objectCollidedWith);

            eqM.AddNumber(gm.number);
    }
Enter fullscreen mode Exit fullscreen mode

With these adjustments, the gameplay feels more dynamic and interactive, offering players a truly immersive experience. I'm thrilled with the progress we've made, and I can't wait to see how players respond to the updated version of the game.

Thank you to everyone who has been following along on this adventure and providing invaluable support and feedback. Together, we're crafting something truly special, and I'm incredibly grateful for the opportunity to learn and grow with such an amazing community.

Stay tuned for more updates as I continue to dive deeper into the world of game development!

Top comments (0)