wilmer
Member
Greetings to everyone in the community:
I need help in this, is that I have an object that works as a touch button, which I separate in the room in 3 instances, whose function is that by clicking on each one, my player moves only to the "Y" position of each instance; my problem is that I have a variable called "lane" for my player, and I want to know how to change the value of the variable between (1,2,3)? (
that is to say, lane = 1) for what? , so to tell my player which lane he is in, since my game is runner type and my player moves in 3 different lanes. Graphically it looks like this:
Inside the room, I make "creation code" and I put this variable to each instance of the object of the button to identify them:
In the player's create event (obj_player), write this as my player starts in lane # 2:
I make this request to use the following code, which tells both the generated object and the player in which lane they are, to understand me a little more, I do not know if it is advisable to use the same variable for two different objects (player and object generated ):
name: Object_box // generated object
step event:
I need help in this, is that I have an object that works as a touch button, which I separate in the room in 3 instances, whose function is that by clicking on each one, my player moves only to the "Y" position of each instance; my problem is that I have a variable called "lane" for my player, and I want to know how to change the value of the variable between (1,2,3)? (
that is to say, lane = 1) for what? , so to tell my player which lane he is in, since my game is runner type and my player moves in 3 different lanes. Graphically it looks like this:
Inside the room, I make "creation code" and I put this variable to each instance of the object of the button to identify them:
Code:
button_id=1
button_id=2
button_id=3
Code:
lane = 2
name: Object_box // generated object
step event:
Code:
var obstacle = instance_place(x, y, obj_player);
if (obstacle != noone && obstacle.lane == obj_player.lane) {
pslife -= 10 //being in the player's position, the player is subtracted -10.
}
Last edited: