Be a Supporter!
Response to: platform game Posted September 4th, 2013 in Game Development

At 9/4/13 07:37 PM, kkots wrote:
At 9/4/13 07:28 PM, wolfbessy wrote:
I am sorry, I can not do that. This almost sounds like an offense to me. My morals don't allow me to commit such a crime. But if you agree to solve the problem yourself, I will help you with my advices.

its having trouble letting me type in the code. anyways thank you so much for the help. i really didnt mean to offend you. Im going to try to get it fixed. thank you for the help

Response to: platform game Posted September 4th, 2013 in Game Development

At 9/4/13 07:15 PM, kkots wrote:
At 9/4/13 06:52 PM, wolfbessy wrote: while (ground.hitTest(_x, _y, true)) {
_y -= gravity;
grav = 0;
}
...
if (ground.hitTest(_x, _y-(height), true)) {
grav =0;
}
This is the only code that matters right now. You are testing collision with ground in 2 places at once: at the beginning and at the end.
At the beginning you use _y as the coordinate for legs, and at the end you use _y-height as the coordinate for legs, which resembles a panic-like fix you desperately did at the last moment. Seeing that your character falls down, its y legs' coordinate has been added a negative value somehow and you are subtracting even more by using _y-height, not fixing the situation.
Let's look at the movie clip with animations. When you go into edit mode into it, you should see a little black cross somewhere on the screen. This cross should be between the character's feet. So you have to move the entire animation upwards. This can be done by using "Edit Multiple Frames" button on the timeline. You have to stretch its borders over the entire animation, select everything and move it up with keyboard by using Shift+Up arrow.
If you can't figure out how to do the above said thing, just use

_y+height/2

instead of

_y

.
And delete the useless second collision check.

I first want to thank you so much for the help. i appreciate it more than you even understand. but at the moment my program is messing up. could you send me the whole thing fixed in a .txt document? my computer is being very frustrating. you can send it to fox237@gmail.com (my email)
thank you
-wolf-

platform not woring Posted September 4th, 2013 in Programming

i need help from someone please. could someone please fix my char so that he actually stays ONTOP of the platform? its been frustrating me for hours.
onClipEvent (load) {
var ground:MovieClip = _root.ground;
var grav:Number = 4;
var gravity:Number = 4;
var speed:Number = 9;
var maxJump:Number = -25;
var doubleJump:Boolean = false;
var touchingGround:Boolean = true;
var fight:Boolean = true;
}
onClipEvent (enterFrame) {
_y += grav;
grav += gravity;
while (ground.hitTest(_x, _y, true)) {
_y -= gravity;
grav = 0;
}if (Key.isDown(Key.UP) && touchingGround) {
grav = maxJump;
mySound=new Sound();
mySound.attachSound("jumping");
mySound.start();
}if (ground.hitTest(_x+5, _y+5, true)) {
touchingGround = true;
} else {
touchingGround = false;
}if(fight == false){
if(Key.isDown(Key.LEFT) && fight != true){
this._x -= speed;
this.gotoAndStop("left");
}else if(Key.isDown(Key.RIGHT) && fight != true){
this._x += speed;
this.gotoAndStop("right");
}else if(Key.isDown(Key.DOWN)){
this.gotoAndStop("crouch");
}else{
this.gotoAndStop("idle");
}
}
if(Key.isDown(Key.UP) && Key.isDown(Key.RIGHT)){
this.gotoAndStop("right jump");
this._x+= speed;
}else if(Key.isDown(Key.UP) && Key.isDown(Key.LEFT)){
this.gotoAndStop("left jump");
this._x-=speed;
}if(Key.isDown(Key.SPACE) && Key.isDown(Key.RIGHT)){
this.gotoAndPlay("stomp right");
fight = true;
}else if(Key.isDown(Key.SPACE) && Key.isDown(Key.LEFT)){
this.gotoAndPlay("stomp left");
fight = true;
}if(this._currentframe == 1){ fight = false;
}if (ground.hitTest(_x+(_width/2), _y-(_height/2), true)) {
_x += speed;
}if (ground.hitTest(_x-(_width/2), _y-(_height/2), true)) {
_x -= speed;
}if (ground.hitTest(_x, _y-(height), true)) {
grav =0;
}
}

platform not woring

platform game Posted September 4th, 2013 in Game Development

my game i am making is proving to be dificult. the charactor in it keeps on falling through the "ground" even though it still works and all. it just goes down further than it should. here is the code for my charactor
onClipEvent (load) {
var ground:MovieClip = _root.ground;
var grav:Number = 4;
var gravity:Number = 4;
var speed:Number = 9;
var maxJump:Number = -25;
var doubleJump:Boolean = false;
var touchingGround:Boolean = true;
var fight:Boolean = true;
}
onClipEvent (enterFrame) {
_y += grav;
grav += gravity;
while (ground.hitTest(_x, _y, true)) {
_y -= gravity;
grav = 0;
}if (Key.isDown(Key.UP) && touchingGround) {
grav = maxJump;
mySound=new Sound();
mySound.attachSound("jumping");
mySound.start();
}if (ground.hitTest(_x+5, _y+5, true)) {
touchingGround = true;
} else {
touchingGround = false;
}if(fight == false){
if(Key.isDown(Key.LEFT) && fight != true){
this._x -= speed;
this.gotoAndStop("left");
}else if(Key.isDown(Key.RIGHT) && fight != true){
this._x += speed;
this.gotoAndStop("right");
}else if(Key.isDown(Key.DOWN)){
this.gotoAndStop("crouch");
}else{
this.gotoAndStop("idle");
}
}
if(Key.isDown(Key.UP) && Key.isDown(Key.RIGHT)){
this.gotoAndStop("right jump");
this._x+= speed;
}else if(Key.isDown(Key.UP) && Key.isDown(Key.LEFT)){
this.gotoAndStop("left jump");
this._x-=speed;
}if(Key.isDown(Key.SPACE) && Key.isDown(Key.RIGHT)){
this.gotoAndPlay("stomp right");
fight = true;
}else if(Key.isDown(Key.SPACE) && Key.isDown(Key.LEFT)){
this.gotoAndPlay("stomp left");
fight = true;
}if(this._currentframe == 1){ fight = false;
}if (ground.hitTest(_x+(_width/2), _y-(_height/2), true)) {
_x += speed;
}if (ground.hitTest(_x-(_width/2), _y-(_height/2), true)) {
_x -= speed;
}if (ground.hitTest(_x, _y-(height), true)) {
grav =0;
}
}

could someone pleas tell me what i am doing wrong?
its actionscript 2 also..

platform game