I am trying to recreate the Trex game from Chrome. I am using Processing and Java to make this game, but I'm still a beginner in programming (the game is also very crude at this stage). To make my game, I created separate pages for the player, main game, and the various cacti that will appear in the game as shown below:
Image of main game code with separate pages at the top
The various cacti in the game are named cactus1, cactus2, and cactus3. The code defining these is quite large, but follow the same structure. The number at the end of the variable shows that cactus it relates to. the code for cactus1 is shown below:
Image of the cactus1 block of code
My problem is that when I tried to add a randomizer (the commented code), the game either doesn't display anything at all or the cacti's height starts freaking out. I tried changing the order of the code as well, but it still does not randomize the spawn or order of the cacti. Please help, thanks in advance! Extra code below:
(main game)
(cacti code)
(player code)
Aucun commentaire:
Enregistrer un commentaire