Hi I'm pretty new here(have done greenfoot for only a few months). Anyway, I'm trying to make it so I can click on an object and have an array change based on the object's data. I have data stored in the array, and added the objects with a constructor that had the data in it. However, the data and the specific objects are not connected. Basically, what I'm asking is if there is a way to see the variables that passed through the constructor of each individual object. Background: I'm trying to make uno, I am using arrays to store the players' hands, and I want to be able to click on a card, then click on the pile to play that card and have the array be updated accordingly.
(this is in my card class)
The arrays in the MyWorld class:
Thank you for your help btw, I really appreciate it ;)
1 2 3 | if (Greenfoot.mouseClicked( this ) && !cardSelected) { //how do i find the specific data from this object(the number and color) and change the array } |
1 2 3 4 | public int p1Hand[][] = { { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, }; |