I still need help making a main menu


#1

ok so I really am into making a main menu but I still dont know how after all this time I still dont know how to make a main menu I cant even make a button work heres an example of what I wanting to make the main menu look like:download%20(6)


#2

Let’s break it down into steps. Have you got as far as being able to put a button graphic on the screen using the UI system?


#3

umm do you mean putting the button a screen with a different background then yes


#4

Cool, then here’s a simple example of listening to the event that the button calls when pressed. https://playcanvas.com/editor/scene/717282

The button toggles the box on/off when pressed. If you look at the script here: https://playcanvas.com/editor/code/604437?tabs=17853206

You can see that the click event of the button is being subscribed to and onButtonClick function is the callback to the event. Inside the onButtonClick function, the logic for turning the box on/off is done there.

Similar logic can be applied to the main menu that you want to show.

Pretty much everything in the PlayCanvas engine is driven by events so knowing the events that can be listened to and how the event system works in generally will help.


#5

o umm ok thnx but what about play buttons and item shop buttons or cosmetic or profile buttons


#6

It’s all the same principle. At the end of the day, it’s about the buttons driving logic in the game so you will need to write your own code that listens for the buttons being clicked and performing some logic.

It’s going to be custom for each game so no-one person outside your team can give you code that will work perfectly for your game.

For example: https://www.miniclip.com/games/virtual-voodoo/en/

In this game, the user can customise the doll at the start. This involves having some data stored somewhere in the game that keeps track of what the user selected for customisation, knowing how to texture swap on the materials on model to change things like hair colour, enabling/disabling different models for the different shaped hair, glasses, clothes etc.

The whole feature is not something that someone in a forum post can answer, it’s something that you need to work yourself up to bit by bit.

In your case, a PLAY button to start the game. Break down the problem into smaller tasks and try to solve them one by one.


#7

yes you are right but Im guessing since im a beggiineer in coding Imma have to leaarn more code and btw do u have any tips on learning hoow to do this stuff


#8

There are many approaches to learning to code. Generally the advice is to start REALLY small and only do one thing at a time.

If you are not that familiar with writing code then a course like this one can help: https://www.khanacademy.org/computing/computer-programming/programming

At the end of that, I would think about doing a very small game such as Pong or Snake with what you have learnt. No extra libraries, just what is taught on the course.

If you want something more interesting and eases you in more, try https://codecombat.com/. Just make sure to select Javascript as your language of choice when you start.

Somewhere inbetween, you can also try this course on Scratch: https://www.udemy.com/scratch-game-programming/?couponCode=SCRATCH_FORUM

All of which will get you started in some way to learning to code and this will take time, so you have to patient while putting the work in. Each of the above should have forums (or there are general forums around) that you can ask in for help.

The game that you are working on (Zombie IO?) is arguably too large in scope for you to start with and starting with the very basics will help you in the long run.


#9

Yes I know thats why we stopped it,it felt to hard and complicated but I know some code from learning at freecodecamp.com but I guess I like actually doing the work rather than learning it but I will take my time like you said if it take the whole year or more.But I have passion for this so I am gonna keep doing it and thnx for your help btw I never met people who wanna help as much as you do thnx