Join for FREE | Take the Tour Lost Password?
[x]

deviantART

 
:iconkainhighwind19:

Artist's Comments

I know I haven't uploaded in awhile. I decided to finally make some code for sloped platformers, after a night of debugging and working on it, I was able to get a working platformer, with clean slopes and walls, along with some semi-nice graphics. I used zero tutorials for it, all from the head.

Comments


love 0 0 joy 0 0 wow 0 0 mad 0 0 sad 0 0 fear 0 0 neutral 0 0
:iconundeadanimations:
Wow you did that by yourself, that's pretty sweet.

Could you explain the code for basic 2D gravity to me? I know like half of it but have never fully grasped it.

--
Do a barrel roll!
:iconkainhighwind19:
Ah, the concept of gravity is very simple, I am not at my home computer but I remember the code

//First, you declare the variables on the movie clip (keep in mind there are dozens of ways to do this)

onClipEvent (load) {
var gravityConstant:Number = 10
var gravity:Number = gravityConstant
var grounded:Boolean = false
}

//Now that we have our variables, we can apply it to the object we are coding on.

onClipEvent (enterframe) {
//this first piece right here basically means it is always being falling by the gravity
this._y += gravity
//this piece here detects if the object is touching ground to make sure it doesn't fall through, if it hits, it is grounded, otherwise it is not grounded.
if (this.hitTest(_root.ground)) {
grounded = true
} else {
grounded = false
}
//This piece here now determines if the gravity should be affecting or not affecting the object
if (grounded == true) {
gravity = 0
} else {
gravity = gravityConstant
}


I don't know if I explained that well enough. I have made a lot of physics engines, some I haven't published, even some with fighting, it is kinda like a hobby. Just ask for any clarification
:iconundeadanimations:
Got it, thanks for the help!

--
Do a barrel roll!
:iconfighterlegend:
Nice. You should put a VCam onto the player.

--
When something goes wrong, most of the time, it goes right.
:iconkainhighwind19:
Vcam, eh? what? [link]
Yo estoy confused.
:iconfighterlegend:
Lol, no..

[link]

Like that :P

--
When something goes wrong, most of the time, it goes right.
:iconkainhighwind19:
ah... what feature is vcam in it? :\
:iconfighterlegend:
[link]

Lol, AS2 and AS3 :)

--
When something goes wrong, most of the time, it goes right.
:iconryuu-ima:
Fun :3 Could you give me the code you used for the stick person? I've been trying to make mine jump and move but it wont... Thanks : D

--
-Oh noes! The powerpuff girls wont respond!! D=

-If you've attempted to glomp your shadows, in hopes of it being Midna, then paste this in your sig!--

Details

February 15
10.7 KB
1.7 KB
73×50

Statistics

11
1 [who?]
125 (0 today)
4 (0 today)

Share

Link
Embed
Thumb

Site Map