Super Gravity

Hi, ive got bored of my other games :slight_smile: and i started a new one for the contest
Im hoping for it to be simple

Your a little blob that runs through the world and cant stop running

there will be little holes with spikes or just a hole

what code do i put to make gravity pull it down but when its on the ground
(MC “ground”) it stops you

thx in advance,
yhack

Make a variable called “Gravity”.
When your blob makes collision with the hole in the ground start the Gravity by making it “true”. Here’s a little example:

// ------------------------------------------------------------>
// setup a gravity
onEnterFrame=function(){
if(Gravity){
//if true, make the blob fall
blob._y++
}
// check if the blob hits one of the holes
if(blob.hittest(hole,true)){
Gravity=true;
}else{
Gravity=false;
}
}
// ------------------------------------------------------------>

This is just one simple ex. If you want to make it right, there are just serval thinks more that you must do,… try to find more information about platform games.

Good luck!

Martijn Himpers

thx, how do i make a variable… is it the thing in the text box when its dynamic and at the bottom?

http://www.kirupa.com/developer/actionscript/tricks/scope.htm

:p: Making a variable is as simple as typing:

Gravity=true; …or… Gravity=false;

The value of Gravity is variable…true or false.
Other variables are for example:

myName=“yhack”; …or… myNumber=123;

The value of myName and myNumber, its variable,…:p:

how bout:

OnClipEvent(enterFrame) {
gravity = 9.8;
_root.char._y += gravity;
}
OnClipEvent(enterFrame) {
if (_root.char.hitTest(ground)) {
_root.char._y -= 9.8;
}
}

OnClipEvent is flash 5,… i see you have typed twice the clipEvent enterframe.
The character doesnt fall when its standing on the ground, only when its hit a hole.

OnClipEvent(load) {
gravity = 9.8;
}

OnClipEvent(enterFrame) {
if (_root.blob.hitTest(hole)) {
_root.blob._y -= gravity;
}
}