mail@pastecode.io avatar
14 days ago
944 B
//I created 2 objects, one named "obj_floor" and one named "obj_player"
//I created 2 64x64 sprites named "spr_floor and "spr_player"

//I created in the Room a floor made out of multiple floor objects one after the other, on the same X axis
//I created the obj_player in the Room above the floor 

//obj_floor create event
sprite_index = spr_floor;

//and that's the only code you need for the obj_floor

//obj_player create event
sprite_index = spr_player;

//obj_player step event

//if keyboard space is pressed
if keyboard_check(vk_space) {
	//if player touches floor
	if place_meeting(x,y,obj_floor) {
		//decrease the Y of the player (move upwards)
		y = y - 60;//you can play with this value as much as you'd like

//if keyboard space is released or not pressed
if !keyboard_check(vk_space){
	//if player is not touching obj_floor
	if !place_meeting(x,y,obj_floor) {
		//increase its Y value (move downwards)
		y = y + 2;		

Leave a Comment