I forgot to account the Horizontal speed of the player when checking for collision.
Code:
//Horizontal Collision slope_max = 10 if !place_meeting(x+sign(Hsp),y,Solid) { for (cd=0;!place_meeting(x+Hsp,y+cd,Solid) && cd<=abs(slope_max);cd+=1;) { if !place_meeting(x+Hsp,y+cd,Solid) and place_meeting(x+(Hsp),y+slope_max,Solid)//Right Here y+=cd; }
}
if place_meeting(x+Hsp,y,Solid) { cu = 0; while ((place_meeting(x+Hsp,y-cu,Solid) && cu <= abs(slope_max))) cu += 1; if place_meeting(x+Hsp,y-cu,Solid) { while (!place_meeting(x+sign(Hsp),y,Solid)) x+=sign(Hsp); Hsp = 0; } else { y-=cu; } }
x += Hsp;
Kinda knew it was something as simple as that >< Hills now behave almost exactly like they did in Yoshi's Island :P
I solved the problem
I forgot to account the Horizontal speed of the player when checking for collision.
[code]
//Horizontal Collision
slope_max = 10
if !place_meeting(x+sign(Hsp),y,Solid)
{
for (cd=0;!place_meeting(x+Hsp,y+cd,Solid) && cd<=abs(slope_max);cd+=1;)
{
if !place_meeting(x+Hsp,y+cd,Solid) and place_meeting(x+(Hsp),y+slope_max,Solid)//Right Here
y+=cd;
}
}
if place_meeting(x+Hsp,y,Solid)
{
cu = 0;
while ((place_meeting(x+Hsp,y-cu,Solid) && cu <= abs(slope_max))) cu += 1;
if place_meeting(x+Hsp,y-cu,Solid)
{
while (!place_meeting(x+sign(Hsp),y,Solid)) x+=sign(Hsp);
Hsp = 0;
}
else
{
y-=cu;
}
}
x += Hsp;
[/code]
Kinda knew it was something as simple as that ><
Hills now behave almost exactly like they did in Yoshi's Island :P
I need a code to make an object change its alpha gradually as you approach it with x object.
Code:
var targetobject = <insert_x_object_here> var maxdist = <insert_how_close_object_has_to_be_to_start_appearing> image_alpha = min(max(1 - (point_distance(x,y,targetobject.x,targetobject.y)/maxdist),0),1);
[quote="Gatete"]Well, I'm on a hurry for this.
I need a code to make an object change its alpha gradually as you approach it with x object.[/quote]
[code]
var targetobject = <insert_x_object_here>
var maxdist = <insert_how_close_object_has_to_be_to_start_appearing>
image_alpha = min(max(1 - (point_distance(x,y,targetobject.x,targetobject.y)/maxdist),0),1);
[/code]
I really put my effort on "pulling" effect, but I can't get the hang out of it. Even though, it is a tough code for me to deal with on "ground-only", "pull from left or right" , "cancellation to crouch" , and "the range of the pull-able block".
I can gladly put the original code I've put down, but I deleted it just for the sake of the ease of frustration. Here is my code for my character:
//Vertical Collision if (place_meeting(x,y+vsp,obj_wall)) { while(!place_meeting(x,y+sign(vsp),obj_wall)) { y += sign(vsp); }
{ if bounce_attack = true && (vsp > 0) && place_meeting(x,y+1,obj_wall)// If Bouncing and in Air { sprite_index = spr_rac_bounced; vsp = -vsp audio_play_sound(snd_player_bounce,1,0) } else vsp = 0;
if jumpland = true && place_meeting(x,y+1,obj_wall) && bounce_attack = false { jumpland = false if climb = false audio_play_sound(snd_player_land,1,0) } } } y += vsp;
//Animation if climb = false // If not in a climb state { if pull = false { if attack = false // If not attacked { if chargeon = false { if (move!=0) image_xscale = move; if (place_meeting(x,y+1,obj_wall)) { if (move!=0) { if bounce_attack = true and place_meeting(x,y+1,obj_wall) sprite_index = spr_rac_bounced; else sprite_index = spr_rac_walk; image_speed = 0.15; } else { if duck = true {sprite_index = spr_rac_duck image_speed = 0;} else if bounce_attack = true and place_meeting(x,y+1,obj_wall) sprite_index = spr_rac_bounced; else sprite_index = spr_rac_stand; image_speed = 0; } } else
if (vsp < 0) or (vsp > 0) { if bounce_attack = true sprite_index = spr_rac_bounce else sprite_index = spr_rac_jump } } } } } if hit = true // If attacked or hit { if image_xscale = 1 { if hurt = true { if !place_meeting(x-4,y,obj_wall) x -= 4 hurt = false } } else if image_xscale = -1 { if hurt = true { if !place_meeting(x+4,y,obj_wall) x += 4 hurt = false } } } //Prevent from going outside the room (on the side) if x < 3 x = 3 if x > room_width-3 x = room_width-3 if y < -5 y = -5
//--Climb-- if (collision_line(x, bbox_top, x, bbox_bottom - 8, obj_rope, false, false)) && keyboard_check_pressed(vk_up) { climb = true // Triggers the activation to climb x = obj_rope.x+8 }
if (climb) // If he is on ladder or climable object { hsp = 0; vsp = 0; jumpable = false if !keyboard_check(vk_up) || !keyboard_check(vk_down) { image_speed = 0 } sprite_index = spr_rac_climb
if climbmovement = true { if keyboard_check(vk_up) { if place_free(x,y-2) image_speed = 0.15; vsp-=2 }
if keyboard_check(vk_down) { if place_free(x,y+2) image_speed = 0.15; vsp+=2 } if (key_up and !collision_line(x, bbox_top, x, bbox_bottom - 8, obj_rope, false, false)) or (!collision_line(x, bbox_top, x, bbox_bottom, obj_rope, false, false)) { climb = false; jumpable = true;
So, i'm trying to Make a circular Transition, i'm trying to do this an work from scratch, with Game maker 8.
So, i've tried the animated sprite, but it keeps animating, even when i put image_speed=0 in Animation End Event. Is there a way to solve it?
So, i'm trying to Make a circular Transition, i'm trying to do this an work from scratch, with Game maker 8.
So, i've tried the animated sprite, but it keeps animating, even when i put image_speed=0 in Animation End Event.
Is there a way to solve it?
How exactly are you making the circular transition? With an animated sprite? If that's the case, try:
Code:
///Animation end event image_speed = 0; image_index = sprite_get_number(sprite_index)-0.01;
How exactly are you making the circular transition? With an animated sprite? If that's the case, try:
[code]
///Animation end event
image_speed = 0;
image_index = sprite_get_number(sprite_index)-0.01;
[/code]
This does not make use of sprites at all, it uses the draw_circle function
[url=https://phpbb.mfgg.net/viewtopic.php?p=478760#p478760]This might help you![/url]
This does not make use of sprites at all, it uses the draw_circle function
This does not make use of sprites at all, it uses the draw_circle function
Yes, Thanks.
[quote="CatoNator"]How exactly are you making the circular transition? With an animated sprite? If that's the case, try:
[code]
///Animation end event
image_speed = 0;
image_index = sprite_get_number(sprite_index)-0.01;
[/code][/quote]
Yes, i used to run that, i scrapped that method before posting, but thanks anyways.
[quote="Gatete"][url=https://phpbb.mfgg.net/viewtopic.php?p=478760#p478760]This might help you![/url]
This does not make use of sprites at all, it uses the draw_circle function[/quote]
Yes, Thanks. :thumbsup:
I need some code for ground pounding in GMStudio please!
If you are able to make your character jump, then a ground pound should simply be the reverse. If your player is in the air and a 'button' is pressed, the characters 'vertical speed' should move down. Gravity should not be applied to the 'vertical speed' when doing a ground pound (unless you want I suppose).
[quote="[url=http://phpbb.mfgg.net/viewtopic.php?p=514988#p514988]littlelum[/url]"]I know this is stupid, but could anyone tell how to make a sprite appear on top of another sprite instead of below?
Edit: It's in gamemaker 8.1[/quote]
Can you provide a screenshot of what is actually happening and what is expected?
[quote="[url=http://phpbb.mfgg.net/viewtopic.php?p=508860#p508860]SilverVortex[/url]"]I need some code for ground pounding in GMStudio please! :confused:[/quote]
If you are able to make your character jump, then a ground pound should simply be the reverse. If your player is in the air and a 'button' is pressed, the characters 'vertical speed' should move down. Gravity should not be applied to the 'vertical speed' when doing a ground pound (unless you want I suppose).
I'm making a frogger type game, and i'm trying to make Mario jump on top of the log
Attachment:
File comment: The picture didn'w work, do this
screenshot105.png [ 6.37 KiB | Viewed 5124 times ]
[img]http://i65.tinypic.com/24ky1k7.jpg[/img]
I'm making a frogger type game, and i'm trying to make Mario jump on top of the log
[attachment=0]screenshot105.png[/attachment]
_________________
"90 percent of everything is crap" - Some guy named Theodore
I know this sounds like a silly question, but does anybody know how to play as knuckles in the sonic game maker studio engine? I tried looking for a way to start testing the engine out as knuckles, but I could not find a way. Can someone please help me? Here is a link to it. https://forums.sonicretro.org/?showtopic=31723
I know this sounds like a silly question, but does anybody know how to play as knuckles in the sonic game maker studio engine? I tried looking for a way to start testing the engine out as knuckles, but I could not find a way. Can someone please help me? Here is a link to it. https://forums.sonicretro.org/?showtopic=31723
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum