Recent posts by Lanerinsaner on Kongregate

Flag Post

Topic: Game Programming / Sound HELP

AS2

 
Flag Post

Topic: Game Programming / Sound HELP

Hey there. I need help with using sounds in my game. Im trying to make it where i can play one sound (like a music loop) and then stop it when it gets to a certain frame. Like on frame one, play music loop 1 and then one frame 4 to some how stop it. I can not for the life of me, figure out how to do this. If u could help that would be great. Thanks! Lane.

 
Flag Post

Topic: Game Programming / Character Attacking-MovieClip Help

None of that worked

 
Flag Post

Topic: Game Programming / Character Attacking-MovieClip Help

Hello, im making a platformer game where the main character has a health bar and stuff like that. What im trying to do is where if that character presses "A, S or D" that character does a movie clip of attacking inside that movieclip. My problem is that whenever i press one of those buttons the character plays only the first frame of that movieclip. Here is my code for the character:
onClipEvent (load) {
var grav:Number = 15 ;
var speed:Number = 5;
var jumpHeight:Number = 12;
var slow:Number = .7;
var slowspd:Number = speed/1.5;
var setspeed:Number = speed;
var scale:Number = _xscale;
var ex:Number = 7;
this.gotoAndStop(2);
}
onClipEvent (enterFrame) {
grav++;
_y += grav;
while (_root.ground.hitTest(_x, _y, true)) {
_y--;
grav = 0;
}
if (_root.water.hitTest(_x, _y, true)) {
if (grav>-1) {
grav *= slow;
}
speed = slowspd;
} else {
speed = setspeed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
_xscale = scale;
if (_root.ground.hitTest(_x, _y+3, true)) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
} else if (Key.isDown(Key.LEFT)) {
_x -= speed;
_xscale = -scale;
if (_root.ground.hitTest(_x, _y+3, true)) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
} else {
if (_root.ground.hitTest(_x, _y+3, true) && !Key.isDown(79) && !Key.isDown(73)) {
this.gotoAndStop(3);
}
}
if (Key.isDown(79) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(73)) {
this.gotoAndStop(5);
}
if (Key.isDown(73) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(79)) {
this.gotoAndStop(4);
}
if (Key.isDown(Key.SPACE) && _root.ground.hitTest(_x, _y+3, true)) {
grav = -jumpHeight;
_y -= 4;
this.gotoAndStop(2);
}
if (_root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/6), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-_height, true)) {
_x -= speed;
}
if (_root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/6), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-_height, true)) {
_x += speed;
}
if (_root.ground.hitTest(_x, _y-_height-15, true)) {
grav = 1;
}
////////////////////////////////////
This is the code for playing that movie clip of the character attacking
/////////////////////////////////////
if (Key.isDown(65)){
	this.gotoAndStop(4)
}
if (Key.isDown(83)){
	this.gotoAndStop(4)
}
if (Key.isDown(68)){
	this.gotoAndStop(4)
}
}
///////////////////////////////////////////
    
 
Flag Post

Topic: Game Programming / On Release Help

Its worked thanks!

 
Flag Post

Topic: Game Programming / On Release Help

Hey. Im making a sniper game (not a crappy one) and i need to know how to make it where if u click on the guy he goes to the next frame inside that movieclip…here is my code

 

on(release){
	gotoAndStop(root(2))
}

Please help!
    
 
Flag Post

Topic: Game Programming / AS2 Timer: How to Add Time

MaToMaStEr: Thanks! From just what you posted helped me alot! And it figured out my problem

 
Flag Post

Topic: Game Programming / AS2 Timer: How to Add Time

I made this time in AS2. It goes down from 30 and when it reaches 0. it goes to a you lose frame…i was wondering how to make a button and when you click it. It adds like 5 seconds. Here is the Short code for the timer:


stop()
timer = 30
countdown = function(){
timer—;
}
if(timer0){ clearInterval(countdownInterval) } countdown = function(){ timer--; if(timer0){
gotoAndStop(2)
clearInterval(countdownInterval);
}
}
countdownInterval = setInterval(countdown,1000);

 
Flag Post

Topic: Game Programming / Character Attacking HELP! (Solved)

Thanks you guys! I found out from all of your answers thanks again!

 
Flag Post

Topic: Game Programming / Character Attacking HELP! (Solved)

Cause they are saying to make classes and i thought that was AS3

 
Flag Post

Topic: Game Programming / Character Attacking HELP! (Solved)

Oh and by the way. I need ActionScript 2. The Shootorials ar AS3

 
Flag Post

Topic: Game Programming / Character Attacking HELP! (Solved)

Dwew3: Or play a movieclip when he dies

 
Flag Post

Topic: Game Programming / Character Attacking HELP! (Solved)

I made a character who makes a shield when space it pressed and i want it to kill the bad guy that moves with a motion tween.. Any ideas?

 
Flag Post

Topic: Game Programming / Character Interactions HELP

 <onclipevent>-1) { grav *= slow; } speed = slowspd; } else { speed = setspeed; } if (Key.isDown(Key.RIGHT)) { _x += speed; _xscale = scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { this.gotoAndStop(2); } } else if (Key.isDown(Key.LEFT)) { _x -= speed; _xscale = -scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { this.gotoAndStop(2); } } else { if (_root.ground.hitTest(_x, _y+3, true) && !Key.isDown(79) && !Key.isDown(73)) { this.gotoAndStop(3); } } if (Key.isDown(79) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(73)) { this.gotoAndStop(5); } if (Key.isDown(73) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(79)) { this.gotoAndStop(4); } if (Key.isDown(Key.UP) && _root.ground.hitTest(_x, _y+3, true)) { grav = -jumpHeight; _y -= 4; this.gotoAndStop(2); } if (_root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/6), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-_height, true)) { _x -= speed; } if (_root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/6), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-_height, true)) { _x += speed; } if (_root.ground.hitTest(_x, _y-_height-15, true)) { grav = 1; } }>
    
 
Flag Post

Topic: Game Programming / Character Interactions HELP

 test<pre>
    
 
Flag Post

Topic: Game Programming / Character Interactions HELP

<onclipevent>-1) { grav *= slow; } speed = slowspd; } else { speed = setspeed; } if (Key.isDown(Key.RIGHT)) { _x += speed; _xscale = scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { this.gotoAndStop(2); } } else if (Key.isDown(Key.LEFT)) { _x -= speed; _xscale = -scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { this.gotoAndStop(2); } } else { if (_root.ground.hitTest(_x, _y+3, true) && !Key.isDown(79) && !Key.isDown(73)) { this.gotoAndStop(3); } } if (Key.isDown(79) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(73)) { this.gotoAndStop(5); } if (Key.isDown(73) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(79)) { this.gotoAndStop(4); } if (Key.isDown(Key.UP) && _root.ground.hitTest(_x, _y+3, true)) { grav = -jumpHeight; _y -= 4; this.gotoAndStop(2); } if (_root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/6), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-_height, true)) { _x -= speed; } if (_root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/6), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-_height, true)) { _x += speed; } if (_root.ground.hitTest(_x, _y-_height-15, true)) { grav = 1; } }>
 
Flag Post

Topic: Game Programming / Character Interactions HELP

I making a game where you move a character and get to the next checkpoint... The problem is that the character (Instance name): "Char". It wont get close to walls or anything. like, for instance. hes trying to push against a wall... he will still walk but be like like half a inch away from it. And to make it where he walks smooth on the ground... Because when he walks its kinda of bumpy. and i made the ground flat.. Here is the code for the character: onClipEvent (load) { var grav:Number = 0; // gravity var speed:Number = 10; // how fast you walk var jumpHeight:Number = 12; // how high you jump var slow:Number = .7; // sets water falling speed var slowspd:Number = speed/1.5; // sets water walking speed var setspeed:Number = speed; var scale:Number = _xscale; var ex:Number = 10; // makes hitTests better, change for a closer hitTest (warning, more buggy if smalle, less real if further) this.gotoAndStop(2); } onClipEvent (enterFrame) { grav++; _y += grav; while (_root.ground.hitTest(_x, _y, true)) { _y--; grav = 0; } if (_root.water.hitTest(_x, _y, true)) { if (grav>-1) { grav *= slow; } speed = slowspd; } else { speed = setspeed; } if (Key.isDown(Key.RIGHT)) { _x += speed; _xscale = scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { this.gotoAndStop(2); } } else if (Key.isDown(Key.LEFT)) { _x -= speed; _xscale = -scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { this.gotoAndStop(2); } } else { if (_root.ground.hitTest(_x, _y+3, true) && !Key.isDown(79) && !Key.isDown(73)) { this.gotoAndStop(3); } } if (Key.isDown(79) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(73)) { this.gotoAndStop(5); } if (Key.isDown(73) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(79)) { this.gotoAndStop(4); } if (Key.isDown(Key.UP) && _root.ground.hitTest(_x, _y+3, true)) { grav = -jumpHeight; _y -= 4; this.gotoAndStop(2); } if (_root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/6), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-_height, true)) { _x -= speed; } if (_root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/6), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-_height, true)) { _x += speed; } if (_root.ground.hitTest(_x, _y-_height-15, true)) { grav = 1; } } ##################################################### And here is the demo of the game (if link doesnt work go to my profile and play The Artist's Disappearance Demo 2): http://www.kongregate.com/games/Lanerinsaner/the-artists-disappearance-demo-2