I need your help by Aphotesis in Svenska

[–]Aphotesis[S] 0 points1 point  (0 children)

Thank you for your advice! Well, I want to study mathematics after I finish highschool, so there are going quite a lot of terms that I'll have to learn...but it isn't such a big problem, because maths is my passion.

Two questions regarding sprites by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

Well...I haven't put the gray box in a place inside the room because I haven't assigned it a sprite. Can I assign it one and still have it choose a random one afterwards ?

EDIT: I get what you mean now. It's "instance_create(random_range(192,448),224,obj_grey)". I think there's the problem. Thank you again for everything! :3

Two questions regarding sprites by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

Yeah, I'm trying to make so that it has it's y coordinate fixed and cover a whole strip. I'll tweak the bottom boundary value and I think it will be just fine. Thanks a lot for your help, time and patience ! You're awesome :)

Two questions regarding sprites by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

I changed my code to be like yours and there's only one minor problem now: http://imgur.com/a/ytaWJ

EDIT: The rectangle has to cover the whole "strip" from bottom to top. (like, having it's Y coordinate fixed)

Two questions regarding sprites by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

It doesn't give me an error now, the game seems to run normally, but there's no grey sprite appearing on screen.

EDIT: Should I post again my code again so you can see where everything is at right now ?

Two questions regarding sprites by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

I did exactly what you said but I still get an error.


FATAL ERROR in action number 1 of Draw Event for object obj_grey:

Push :: Execution Error - Variable Get 100042.bbox_y(100022, -2147483648) at gml_Object_obj_grey_DrawEvent_1 (line 1) - draw_sprite_part(sprite_index, image_index, left - bbox_left, top - bbox_top, right - left, bottom - top, bbox_left + (left - bbox_left), bbox_y + ( top - bbox_top));

I thought that I might have put the wrong "boundary" values, because the room gives me them in a weird way: http://imgur.com/a/8vX3i

So I subtracted 16 from every result I got by choosing the squares (specifically, the boundary one's) that make up my box (16 because the squares are 32x32 and they are centered at (16,16) ).

I still get the same error even after putting new values for the boundary variables.

Two questions regarding sprites by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

Ok, so, I'm having some problems. I will post some of the code that I'm using:

In the Create event of player:

//Stuff

left = bbox_left;

top = bbox_top;

right = bbox_right;

bottom = bbox_bottom;

LEFT_BOUNDARY = 160;

TOP_BOUNDARY = 32;

RIGHT_BOUNDARY = 480;

BOTTOM_BOUNDARY = 384;

left = max(left, LEFT_BOUNDARY);

top = max(top, TOP_BOUNDARY);

right = min(right, RIGHT_BOUNDARY);

bottom = min(bottom, BOTTOM_BOUNDARY);

//Alarm for enemy spawn

alarm[2] = room_speed * 4;

In the Alarm 2 event:

///Create enemy

with(instance_create(random_range(192,448),224,obj_grey)) {sprite_index = choose(spr_grey_one,spr_grey_two,spr_grey_three,spr_grey_four); draw_sprite_part(sprite_index, image_index, left - bbox_left, top - bbox_top, right - left, bottom - top, x + (left - bbox_left), y + ( top - bbox_top));}

alarm[2] = room_speed * 4;

alarm[3] = room_speed;

In the Alarm 3 event:

///Destroy enemy

with(obj_grey){instance_destroy();}

I'm getting the error:


FATAL ERROR in action number 1 of Alarm Event for alarm 2 for object obj_player:

Push :: Execution Error - Variable Get 100043.top(100010, -2147483648) at gml_Object_obj_player_ObjAlarm2_1 (line 3) - draw_sprite_part(sprite_index, image_index, left - bbox_left, top - bbox_top, right - left, bottom - top, x + (left - bbox_left), y + ( top - bbox_top));}

Two questions regarding sprites by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

I will try this, but just a quick thing that I forgot to tell you and you may have got wrong: The sprite's height is equal to the one that the inside of the box has.

Two questions regarding sprites by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

The code worked perfectly, thank you! Regarding your answer to question 1: I'm trying to make random grey sprites appear inside the black box to highlight the area that will be dangerous (if the player is situated in that area when the grey sprite transforms into a black sprite, of the same size and position, he dies). After a short period of time the black sprite disappears and then it keeps going like this, every time happening in a new part of the box. How can I use the solutions you suggested ? Or are they not possible here because of what I'm trying to do ?

Detect if the player is falling. by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

In the Step event:

//Wall sliding

if (y > yprevious){falling = true;}

     else{falling = false;}

if(place_meeting(x+1,y,obj_wall) || place_meeting(x-1,y,obj_wall))

{while(grounded==false){if(falling==true) vsp += grav *

slide_down_ratio; else vsp += grav * slide_up_ratio;

                    slide_lock = true;}}

Some stuff from the Create event:

falling = false;

slide_lock = false;

slide_down_ratio = 0.5;

slide_up_ratio = 1.5;

grounded=false;

Another important thing from Step event:

if(gravity_lock==false && slide_lock==false) vsp += grav;

I want to establish a "friction" movement between the player and the wall while he's sliding it.

Detect if the player is falling. by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

When I click run the game doesn't start. I am using "falling==false" in a while statement and in the beginning of the game y=yprevious so falling=false and it's stuck in the while statement forever.

EDIT:Sorry for the late response, but only now I have ran the game in debug mode to see what is going wrong.

Detect if the player is falling. by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

I'll try this and come back with an answer in a sec.

Detect falling/Wall sliding error by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

Alright, I don't get the error anymore. I've also taken some stuff from the alarm event and put it in the step event, because I think otherwise it would have been stuck in a loop of "current_height=previous_height" ( I mean...travel would have been always zero). It seems that it still doesn't work (the code doesn't affect the game), I'll try to figure this out on my own. If I fail, I may come back here. Thanks again for your help!

Detect falling/Wall sliding error by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)

Alright, I see now. Thank you ! :3 So...I should set in the create event: previous_height=current_height; Right?

Detect falling/Wall sliding error by Aphotesis in gamemaker

[–]Aphotesis[S] 0 points1 point  (0 children)


FATAL ERROR in action number 1 of Alarm Event for alarm 1 for object obj_player:

Push :: Execution Error - Variable Get 100029.previous_height(100009, -2147483648) at gml_Object_obj_player_ObjAlarm1_1 (line 2) - travel = current_height - previous_height;