Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Voxera113887yYou first set tappedCounter index to activeplayer, then check if it is 2 which according to comment is unplayed.
Will activePlayer ever be 2?
If not the if will never be true. -
@Nbfour so I actually just figured it out. I had counter.setTranslationY(-1000f); above all of this so every time i pressed it looped that 1 piece of outside code over and over. So I placed it at the bottom and viola problem gone. However, to answer your question yes I did that last night I've been on this upwards of 22hrs.
-
@Voxera yes actually tapped counter is started off as 2 once pressed it'll be set to the active players numbers i didn't full code you guys i just thought the problem was within this area.
-
Wack61917y@ihavePCSD for the love of Linus Torvald, please post code snipets using something like https://pastebin.com or if your snipped is HTML/CSS/JS, use something like https://jsfiddle.net
Thank you!
Related Rants
Ik i probably should have went to stack overflow but you guys seem so much more immediate. I'm building a simple tic tac toe game however whenever i hit a tile the second time the counter disappears i refuse to go on to the winning logic before getting this resolved help!!!!
gameState[tappedCounter] = activePlayer;
if (gameState[tappedCounter] == 2) {
//if tapped counter is unplayed
if (activePlayer == 0) {
((ImageView) view).setImageResource(R.drawable.knight);
activePlayer = 1;
//displays knight
//sets active player to player 2
} else if (activePlayer == 1) {
((ImageView) view).setImageResource(R.drawable.sam);
activePlayer = 0;
//displays sam as player 2 character
//sets active player back to player 1
}
undefined
java
help
i need you
omfg
im going to lose my mind