14,574 Forum Posts by "Denvish"
At 3/31/09 08:14 AM, Jayspear wrote: I am working on a relatively simple flash platform game, but the problem is for me that the chatacter only stops falling against one specific platform, even though the other ones is a copy of the first.
if(this.hitTest(_root.golv))
This only checks against one MC, instanceNamed golv
To hitTest against multiple platforms, you need to use a for loop to check against all instance names of the different platforms... eg:
onClipEvent(enterFrame){
this.contact=0;
for(var i=1;i<5;i++){
if(this.hitTest(_root["golv"+i])){
this.contact=1;break;
}
}
if(this.contact){
_y+=0;
}else{
_y+=gra;
}
}
This assumes your instance names for the platforms are golv1, golv2... golv4
For future reference, you only need one (not three) onClipEvent(load) and onClipEvent(enterFrame)
Basically the reason you're not seeing the animation is because the MC playhead is being sent to frame 4/5 on every enterFrame, so all you'll see is the first frame of the animation since it gets reset every time the code runs.
This is complicated, because the enterFrame has so many Key.isDown checks, but basically you need to set a boolean (true/false or 1/0) crouched and only run the gotoAndPlay(4/5) if NOT crouched already. Unfortunately as I said, you have so many keychecks already, I don't have time to fix it perfectly, but hopefully this'll help you in the right direction.
onClipEvent (load) {
var crouched=0;
var grav:Number = 0;
// gravity
var speed:Number = 10;
// how fast you walk
var jumpHeight:Number = 15;
// 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 = 5;
// 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>0) {
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 (!crouched && _root.ground.hitTest(_x, _y+3, true) && !Key.isDown(79) && !Key.isDown(73)) {
this.gotoAndStop(3);
}
}
if(Key.isDown(Key.DOWN)){
if (!crouched && !Key.isDown(Key.UP) && Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && !Key.isDown(73)) {
this.gotoAndStop(5);
}
if (!crouched && !Key.isDown(Key.UP) && !Key.isDown(Key.LEFT) && Key.isDown(Key.RIGHT) && !Key.isDown(73)) {
this.gotoAndStop(5);
}
if (!crouched && !Key.isDown(Key.UP) && !Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && !Key.isDown(79)) {
this.gotoAndStop(4);
}
crouched=1;
}else{
crouched=0;
}
if (!crouched && 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;
}
}
At 3/30/09 09:18 PM, fluffkomix wrote:At 3/30/09 09:08 PM, Shinki wrote: Use removeMovieClip() on all of the rain particles.well i've been fiddling around with it and i can't seem to get it. what do you mean by that?
for(var i in _root){
if(_root[i]._name.substr(0,2)=="rd"){
_root[i].removeMovieClip();
}
}
Code on main timeline:
kl=new Object();
kl.onKeyDown=function(){
if(Key.getCode()==32){
//DO STUFF
}
}
Key.addListener(kl);
AS: Rain Effect (API) by Inglor
At 3/25/09 09:58 PM, MidnightHowl wrote: There seems to be so many dangers on this planet. Dangers that could wipe out all humans. Nukes wiping everyone out. Volcanoes erupting and killing everyone. Meteorites crashing into the planet. Black holes sucking us all up. You get my point. There is so much danger yet I don't feel threatened.
Huh? That's a pretty negative view on life. Volcanoes ain't going to wipe out any more than the local population, if there was a black hole anywhere nearby we'd know about it, and I don't think anyone's gonna be firing nukes in the near future
I know there is a good chance that something horrible will happen tomorrow that could kill me yet I feel safe and happy. Is something wrong with me?
Nah, you're cool
At 3/25/09 09:51 PM, lawlmaster wrote: i think its because the left clicker is rubbing against the rubber wheel.
Nope, my diagnosis from your description of your problem is that there's a baby bird inside your mouse and it just wants to flyyyyyyyyyyyyyyyyyyyyyy
At 3/25/09 09:50 PM, TexMonkey wrote: I read "concentration" as "contraception" at least three times. D'oh.
You're having a baby? Congratulations
At 3/25/09 09:41 PM, Kwing wrote: Just a few days ago, I'm suddenly way worse at video games, not as good at climbing, and I'm really just doing everything worse. I have no idea why, though. I've gotten a little sick over the past few days, but I don't see how this would effect my reflexes or anything, and I've also taken on a little depression.
It's not about reflexes, it's about concentration. If you can't concentrate as well (whether due to sinuses, flu, whatever), everything will be harder to do. Don't fret it, relax and get better.
You also already asked this in Wi/Ht, and blah
At 3/25/09 09:39 PM, Mastasolo wrote: How do i access Newgrounds Medals??? i NEED to know
You need a decent time machine and a great deal of globular molecules
At 3/25/09 09:36 PM, fluffkomix wrote: just think, Tom and April had sex in June or so.
hot, passionate summer love :3
Put it back in your trousers
lol putting 'Official' in the topic title doesn't make it OK to advertise your WIP
At 3/25/09 09:29 PM, Headshot777 wrote:At 3/25/09 09:25 PM, Inquizitor wrote: Conficker's been around since November, but I'm pissed that there are still so many "Sixpack Joe" computer owners who don't even know about it.Why has it never been discussed here?
Probably because those who know how to fix it do so. The others just get their PCs fixed by a professional and curse the fact they lost all their photos/porn
At 3/25/09 08:49 PM, Heinrich wrote: Damn, Here's a working link.
Yes
At 3/25/09 09:26 PM, Gimgak wrote: Nu-uh, stamper will be running newgrounds...
Think of how it would look then...
Pink, most likely
At 3/25/09 09:21 PM, tuckerton296 wrote:It infects approximately 1 in sixteen PCs.1 out of 16 computers dosent have mccafee
of what ever the fuck its spelled as
McAfee SUCKS, dude. I wouldn't trust it as far as I could throw a blue whale
Congrats Mr Tom Fulp Esq and good luck. Hope he's a good sleeper, for your sake and April's.
At 3/25/09 09:09 PM, PaperBat wrote: ok, sorry mods, lock this...
OK. Damn that twittering, eh?
At 10/28/07 09:58 PM, Armegalo wrote:At 10/22/07 02:43 PM, WarpZone wrote:
Whenever I try this, the whole screen is white, no matter what, until it finishes downloading. The text box does not appear until the Download Simulation is 100% complete. I can't get trace events to fire, either.
Is that something to do with when you "export for actionscript" it automatically ticks the box "export in 1st frame". You then need to untick that box on everything that you export.
I'm sure there's an easier method but then I would normally place all the symbols I was exporting in the 1st frame into an object in the 2ndframe and make sure that the user doesn't see it!
While this is bumped, might as well answer the question. Generally, if you don't see the preloader (in either AS2 or 3) until the movie's nearly finished loading, it probably means that you've got a large music file and have got it set for 'Export for Actionscript' and 'Export In First Frame' set in the Library>Right Click>Linkage for the wav/mp3 file.
Keep the 'Export for Actionscript' checked, but untick the 'Export in First Frame'. Instead, start your whole movie/game on frame 3, create a new MC (I call it SFX), and add every sound to a seperate frame within that MC. Then chuck that MC from the library to Frame 2, main timeline of your fla. This basically forces it to become part of the preload, rather than trying to pre-empt it, but still means your sounds will be accessible to attach throughout the movie/game, via their linkage.
At 3/25/09 08:58 PM, CompleteDouche wrote: So in the next frame i position the character with x and y coordinates Within the movieclip, or within the total timeline actions?
i think the latter but...
Try both and see what happens :)
But yeah, it's the latter
Assuming the Instance Name of the player is 'player', you just need to add some actions to frame 2 of the game, eg:
player._x=300;
player._y=200;
At 3/25/09 07:42 PM, flaminggranny wrote: I just finished an "All In One" video component for Flex 3. With it you can connect, display and control videos in Flex with one class. Hope you guys enjoy it!
All In One Video Component
Nice, and I like the beard. Still compelled by the job (and an instinctive dislike of OOP) to use AS2, but I've downloaded the component in preparation for that fateful day when I'll be forced to move on to AS3 :)
You should find AS3: Main and add a link to this there for the next time the list's updated
At 3/25/09 06:28 PM, MichaelHurst wrote:At 3/25/09 06:27 PM, J1mp wrote: hahah shit man... im gonna name my son Ultra Bear.Mine is gonna be named Denvish.
That's an awful name
You need to send those parameters to the interval function when you set it up, ie:
function WaterSplash(instName:String, position:Point, speedMult:Number, depth:Number) {
life = (Math.random()*50)+50;
radius = (Math.random()*25)+25;
interval = setInterval(fadeWater, 1000/48, instName, radius, life);
}
function fadeWater(mc,rad,lif) {
trace(mc + " " + rad + " " + lif);
}
On MC:
onClipEvent(enterFrame){
if(_root.player.hitTest(this)){
_root.GOTHIT();
}
}
On main timeline:
invulnerable=0; //BOOLEAN
invTime=1.5; //NUMBER OF SECONDS' INVULNERABILITY
function GOTHIT(){
if(!invulnerable){
invulnerable=1;
lives--;
clearTimeout(fff);
fff=setTimeout(function(){invulnerable=0;},invTime*1000);
}
}
At 3/25/09 09:26 AM, annanas wrote: as far as I remember when I tried using avi. none of the moving movie clips would show
Yeah, movieclip animations won't work when exporting to avi. Your best bet is to install and run a program which videos your desktop, such as Camtasia, then just record the playing swf to that.
Make sure it's being run on enterFrame, and also put in a trace to see whether the hitTest is registering or not
At 3/24/09 02:33 PM, dudejonne wrote: It ís a dynamic textfield with instance name thing scorefield.
scorefield.text= score;
Wow, I did a major discovery :D
On a previous frame I also had a textbox with name scorefield, so this one doesn't works :p
Now its named scorefield2 andit works.
It depends where you declare the .text. The var is constantly updated, the .text is a one-off - so if you declare scorefield.text= score; before the dynamic textbox with the instance name scorefield exists, it won't show the text you send (once it DOES exist)

