Making an apple fall properly
#1
Posted 16 June 2011 - 06:42 PM
#2
Posted 16 June 2011 - 07:02 PM
Howdy, zakaos, and welcome to the GMC. Your file is hilarious! I have an idea that maybe an apple is dropping each game step instead of each second, but it's hard to tell exactly what's going on because you uploaded the .exe instead of the .gm81 source. Try again, and let's see what happens. $:^ ]
Regards,
#3
Posted 16 June 2011 - 08:30 PM
#4
Posted 16 June 2011 - 09:12 PM
Regards again,
#5
Posted 17 June 2011 - 06:21 AM
Did you actually take the tutorials? It should lead you through pretty well through alarms and how to use them. But that's the short answer: alarms. (And a slightly longer answer: set an alarm to room_speed*(number of seconds) and have the alarm then set itself every time it executes; room_speed is the number of steps taken per second, which is why room_speed*(number of seconds) will result in that-many-seconds.) But if you haven't already, please check out the official tutorials! They're very helpful!
Regards again,
Wow thanks so much for your help!
what you suggested did exactly what i needed.
my proof of concept is really coming together,
next i need to do something about the way they land,
seen here:
http://www.filedropper.com/applecrazy02
you can see my gm file here:
http://www.filedropper.com/applecrazy_1
#6
Posted 17 June 2011 - 08:15 AM
Lol... I am not good with physics :/
Apple:
Create event:
TimesOnGround = 0; VSPEED = 0; gravity_direction = 270;
Step:
if (place_free(x, y + 1))
{
gravity = 0.5;
}
else
{
gravity = 0;
hspeed = 0;
}Collision with object 'Solid'
move_contact_solid(direction, 12);
if (TimesOnGround < 8)
{
switch (TimesOnGround)
{
case (0):
{
vspeed = -choose(3, 4, 5);
VSPEED = vspeed;
x -= choose(-1, 1, -1, 2);
image_angle = random(20);
break;
}
case (1):
{
vspeed = VSPEED + choose(0.5, 1, 1.5, 2);
hspeed = choose(1, -1, 1, -2);
image_angle = random(20);
break;
}
case (2):
{
vspeed = VSPEED + choose(0.5, 1, 1.5, 2);
hspeed = choose(1, -1, -1, 2);
image_angle = random(20);
break;
}
case (3):
{
vspeed = VSPEED + choose(0.5, 1, 1.5, 2);
hspeed = choose(-1, -1, 1, 2);
image_angle = random(20);
break;
}
case (4):
{
vspeed = VSPEED + choose(0.5, 1, 1.5, 2);
hspeed = choose(0, -1, -1, 1, 2);
image_angle = random(20);
break;
}
case (5):
{
vspeed = VSPEED + choose(0.5, 1, 1.5, 2);
hspeed = choose(0, 1, -1, -1, 2);
image_angle = random(20);
break;
}
case (6):
{
hspeed = choose(0, 1, -1, 1, -2);
image_angle = random(20);
break;
}
case (7):
{
vspeed = 0;
hspeed = 0;
break;
}
}
TimesOnGround += 1;
}
else
{
vspeed = 0;
hspeed = 0;
}Be sure to make Solid to solid. Lol.
Edited by Diventurer, 17 June 2011 - 09:17 AM.
#7
Posted 17 June 2011 - 04:15 PM
ummm... that looks great gut i would just put this is a collision event with the floor:
move_contact_solid(direction,12) vspeed=0you do need the floor object and the whatever is falling to be solid. however, this does not have a bouncing effect. i just think a shorter code would be best for first time users.
Edited by KaptainKool96, 17 June 2011 - 04:17 PM.
#8
Posted 19 June 2011 - 12:02 AM
i started working on making the apples age and decay,
I zipped the executable with the source file,
feel free to check it out if you want.
http://filepak.com/u..._applecrazy.zip
Edited by zakaos, 19 June 2011 - 10:20 PM.
#9
Posted 16 July 2011 - 06:25 AM
#10
Posted 22 July 2011 - 10:31 PM
I see you're still having trouble with the bouncing...
But the hit detection feels pretty natural at least. ~nodnod~
Okay, bouncing. I just looked at your old v4's bouncing setup, saw what I figured was the problem, and then tried a solution which worked. Is your new v5 using the same (faulty) landing/bouncing setup, or have you tried to change it?
Regards,
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











