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.
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 groundedoolean = 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
DeviantART and the martial arts action film, Ninja Assassin, have teamed up to allow ALL deviants the ability to install Journal Skins! Select an awesome Ninja Assassin skin or choose the skin of your choice.
Daily Literature Deviations is a group that is dedicated to bringing literature to the forefront of the deviantArt community. We attempt to accomplish this by daily featuring Literature artists from around the community that deserve the recognition, but are not getting it.
Each day we will feature 5 deviations from the Literature categories in a News Article. In order to support the artists that we feature, we ask that you the news article as well as check out the individual pieces. We understand that each day you may not be able to check out each and every one of the pieces, everyone has their own things going on. We just ask that you make an attempt to help support the growing Literature community.
The Deviousness Award is an accolade which is traditionally handed out on the 1st of every month to one trully outstanding deviant. `Cyantre is one of the most helpful deviants within our community. With a positive attitude and a resourceful mind, you can always find him providing support and encouragement to those in need. Always looking for ways in which he can get more involved in our community, John's positive presence is to be aspired to. A well respected poet, John is a must-have on your deviantWATCH to make sure that you don't miss out on your dose of community inspiration. It's with great pleasure that the Deviousness Award for November 2009 goes to... Read More
Comments
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!
//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
}
//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
--
Do a barrel roll!
--
When something goes wrong, most of the time, it goes right.
Yo estoy confused.
[link]
Like that
--
When something goes wrong, most of the time, it goes right.
Lol, AS2 and AS3
--
When something goes wrong, most of the time, it goes right.
--
-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!--
Previous Page12Next Page