artistical
Member
Hello my game current have fps,coin system,traps,checkpoint,life system,fade block,falling block and only two problem i have now.
My first problem is push ups block that i use from other engine to my new one.
End step script
Scripts
PlaceMeetingException
OnGround
Approach
Second problem is worst part about jumping
End Step jump code
This code give me error
// HIGH JUMP!
with (obj_Stick)
v = -jumpHeight * 2;
When i remove a v = jumpheight my player just shakescreen not jump automatic like on this video
My first problem is push ups block that i use from other engine to my new one.
End step script
GML:
// Actual collision checks + movement
var i;
// Vertical
for (i = 0; i < abs(v); ++i) {
with (obj_Stick) {
if (place_meeting(x, y + 1, other.id)) {
if (!PlaceMeetingException(x, y + sign(other.v), obj_GroundCol, other.id))
y += sign(other.v);
}
if (place_meeting(x, y - 1, other.id))
y += sign(other.v);
}
if (!place_meeting(x, y + sign(v), obj_GroundCol))
y += sign(v);
else {
v = 0;
break;
}
}
// Push stacks of blocks
with (oIce) {
if (instance_place(x, y + 1, oIce))
h = (instance_place(x, y + 1, oIce).h);
}
// Horizontal
for (i = 0; i < abs(h); ++i) { // Move stacks
// UP slope
if (place_meeting(x + sign(h), y, obj_GroundCol) && !place_meeting(x + sign(h), y - 1, obj_GroundCol))
--y;
// DOWN slope
if (!place_meeting(x + sign(h), y, obj_GroundCol) && !place_meeting(x + sign(h), y + 1, obj_GroundCol) && place_meeting(x + sign(h), y + 2, obj_GroundCol))
++y;
if (!place_meeting(x + sign(h), y, obj_GroundCol))
x += sign(h);
else {
// Push other push blocks
if (place_meeting(x + sign(h), y, oIce)) {
with (instance_place(x + sign(h), y, oIce))
if (instance_exists(obj_Stick))
h = obj_Stick.h
} else
h = 0;
break;
}
}
///////////////////////////////////////////////////////////////////////////////
PlaceMeetingException
GML:
var exception = argument3;
with (argument2) {
var callingObj = id;
if (id == exception)
continue;
else
with (other)
if (place_meeting(argument0, argument1, callingObj))
return true;
}
return false;
GML:
/// OnGround();
return place_meeting(x, y + 1, obj_GroundCol);
GML:
/// Approach(start, end, shift);
if (argument0 < argument1)
return min(argument0 + argument2, argument1);
else
return max(argument0 - argument2, argument1);
Second problem is worst part about jumping
End Step jump code
GML:
// Launch player
if (place_meeting(x, y - 1, obj_Stick)) {
// Shake screen
with (oCamera) {
alarm[0] = 10;
screenShake = true;
}
// HIGH JUMP!
with (obj_Stick)
// Particles
var i;
for (i = 0; i < 8; ++i)
with (instance_create(x + 8 + random_range(-8, 8), y, obj_Particle_Dust))
direction = 90 + random_range(-45, 45);
}
// Launch push blocks (copy + paste)
if (place_meeting(x, y - 1, oIce)) {
// Shake screen
with (oCamera) {
alarm[0] = 8;
screenShake = true;
}
// HIGH JUMP!
with (instance_place(x, y - 1, oIce)) { // Target specific push block
v = -14;
if (place_meeting(x, y - 1, obj_Stick)) {
obj_Stick.y -= 14;
}
}
// Particles
var i;
for (i = 0; i < 8; ++i)
with (instance_create(x + 8 + random_range(-8, 8), y, obj_Particle_Dust))
direction = 90 + random_range(-45, 45);
}
if place_meeting(x+hspeed,y,obj_Stick)
{
hspeed = -hspeed;
}
//vertical
if place_meeting(x,y+vspeed,obj_Stick)
{
vspeed = -vspeed;
}
// HIGH JUMP!
with (obj_Stick)
v = -jumpHeight * 2;
When i remove a v = jumpheight my player just shakescreen not jump automatic like on this video
GML:
############################################################################################
FATAL ERROR in
action number 1
of Step Event2
for object oJump:
Variable obj_Stick.jumpHeight(100019, -2147483648) not set before reading it.
at gml_Object_oJump_StepEndEvent_1 (line 11) - v = -jumpHeight * 2;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oJump_StepEndEvent_1 (line 11)
Attachments
-
79 KB Views: 1