Changing player 'states'

Chasersgaming

New member
I have been looking through the scripts, trying to familiarise myself with the code and how they work and correspond etc as i want to be able to manipulate the scripts in my own way, however, im struggling to get my head around a few things, such as 'player states'. im currently using the platform module, so in game objects i have player, melee etc. i wanted to change the melee to something else from either a button press or a collision with a particular tile. in order for my player to behave differently, So im kind of asking, how does one change the 'player state'? what script is pointing to what state?

example:
Player 'sober state'(game object player)= inputs = up moves up ,down moves down, left moves left, right moves right. (normal module script)
player 'drunk state'(game object melee?)= inputs = up moves down, down moves left, left move right , down moves up.

if a flag was active change state to ......... else.......... change back

hope i explained that well, probably not. :)
 

Razzie.P

Member
I'm no coding guru by far, but if I'm understanding your question correctly, the code you're looking for is --

Code:
ChangeObjectState arg0, arg1
	arg0 = what state to change the object to
	arg1 = initial animation timer

There doesn't seem to be a specific script that points to the states. It's just those lines of code added to whichever script you're using, whether it's the script you assign to an imput, or the script you assign to a tile collision.

To change your player's state, it might look something like this, for example -

Code:
	LDX player1_object
	ChangeObjectState #$02, #$04
 
Top Bottom