i can’t find any turn-based script for a game making. this is need for a project and if this is settled, the rest should be able to continue
well i guess thats something you would have to write yourself. i’m not aware of any pre-made scripts for this. but if you know some basic python and panda it shouldnt be difficult.
maybe as a start. you can write a function which calls everything you want to have done in one round. then you could put this function into a task which is executed every… dunno 15 seconds or so. if you need help with actual coding feel free to ask
Here’s what I do:
In my game, each player controls a ball.
I save the current player in a variable, for example self.turn. Players are counted from 0 to playerCount-1.
I make self.ball contain an array of balls, like this:
self.playerCount=3 #for example 3 players self.turn=0 #player 0 starts self.ball= for i in range(self.playerCount): self.ball.append(loader.loadModel('blah')) self.ball[-1].setPos(i*1.5,0,0) self.ball[-1].reparentTo(render)
And whenever a player moves, I control the appropriate ball in the list:
def moveForward(self): self.ball[self.turn].setY(self.ball[self.turn],5) #move the current player's ball 5 units forward
If the turn is ended, I simply increase self.turn:
def nextTurn(self): self.turn+=1 #next player #now, check whether its not too big, if it is, make it zero if(self.turn>=self.playerCount): self.turn=0
Having played many turn based games what you guys are talking about does not makes since. In turn based games units/stuff normally have points/states such as moved, attacked. And move over fixed tiles/regions. Some turn based games allow you to move one token (chess) or many (Civilization) The only turning feature is that there is an “END TURN” button or state.
“turn-based script for a game making.” There is no script that will make you a game - any kind of game.