Be a Supporter!
Response to: Look here. Very strange. Posted August 26th, 2008 in Game Development

At 8/25/08 07:15 PM, Spaltzer wrote: It appears that your "HP" variable is defined as a text variable. Thus when you add "20" to "100" in text, it will just attach the 20 to the end, like you're seeing. If you HP variable was numerical, you could say _root.HP += 20;

Yea. you seem to be right. I changed the variable so it was just _root.hp = 100; not _root.hp.text = 100;

ALSO, I tried NegativeOnes sulution, and it worked very nice =) Thanks to you all!

Got one problem still. It seems that my character must hold still when im drinking potions (I cant walk left or right while im drinking). Do you know what the problem might be?

Response to: Win A Cintiq 21ux Tablet Posted August 25th, 2008 in Game Development

Wohoo. That is really the product of my dreams ^^ Can't imagine if it will come with the postdelivery today :D

Look here. Very strange. Posted August 25th, 2008 in Game Development

Hello again!

And thanks to everyone who helped me erlier =) Now I got a bit of another problem to solve. I am doing a little inventory system. If you pick up a potion _root.item1 == true, and if you press 1 you will drink this potion and _root.item1 == false;

this is my code:
else if (Key.isDown(49) && _root.item1 == true) {
_root.hp.text += 20;
}

The thing is that my HP doesnt go up by 20. Insted the HP will put 20 behind it. So if ex I got 100 hp it will be 10020, if I got 90 it will be 9020 and so on.

Then I use ++ it works. But to increse the hp with only 1 everytime you drink a potion is not good =)

Any suggestions?

Response to: Regen. Even possible in AS2.0? Posted August 25th, 2008 in Game Development

At 8/25/08 02:58 PM, Cecemel wrote:
At 8/25/08 02:57 PM, Cecemel wrote:
there is something wrong with my 10000/fps right?
I'm sorry, if you want it every 5 frames it should be 50000/fps >.>

ohh thats true. I thought that number was declaring then the function was starting, not how often it calls.
Well. I am using your simple code now, and it works perfectly =)
Tho I got some more problems now which I need to solve ^^

Response to: Regen. Even possible in AS2.0? Posted August 25th, 2008 in Game Development

At 8/25/08 12:22 PM, zedd56 wrote: waoh lulz i didn't see that post
almost exact same thing i posted @.@

HAHAHAH! Thats no problem =) It is fun to see two guys thinking at the same level actually heheheh =D

Response to: Regen. Even possible in AS2.0? Posted August 25th, 2008 in Game Development

At 8/25/08 02:20 PM, Claxor wrote:
At 8/25/08 02:15 PM, satan112 wrote: You'd be better off using an Interval.
You wouldn't. An interval isn't dependant on frames, so if the game lags, the player will heal faster than he should.

I'd personally use modulos instead of resetting the variable as well, but that is a very minor difference.

I used Satans function, and it worked great in one way. Tho my hp is incresen terrible fast, and I don't see a way to change it so it would regen slower :S

Tho it is a good function. Lag could be a problem as you said Claxor

Response to: Regen. Even possible in AS2.0? Posted August 25th, 2008 in Game Development

At 8/25/08 11:47 AM, Cecemel wrote:
At 8/25/08 11:40 AM, Wolfears2 wrote: Also, stop discrediting AS2 as an inferior language. It's been perfect for me all the time I've been using flash. Just because we now have AS3, Doesn't mean AS2 immediately sucks.
I agree
anyway, put a variable = 0 in your onload
and in the onenterframe something like
variable++
if(variable > 5){
variable = 0
health ++
}

It is perfect, logic and absolutly perfect : D I will try that thing out

Response to: Regen. Even possible in AS2.0? Posted August 25th, 2008 in Game Development

At 8/25/08 11:40 AM, Wolfears2 wrote: The only way I can think of is increasing your variable by one every so often using setInterval. Also, stop discrediting AS2 as an inferior language. It's been perfect for me all the time I've been using flash. Just because we now have AS3, Doesn't mean AS2 immediately sucks.

Okey. I am quite unfamiliar with the setInterval thing =) Do you know how it works and how it could help me?

YEA! AS2 is really good. I have not looked into AS3 yet, but it sure looks a lot a lot different from 2.0

Regen. Even possible in AS2.0? Posted August 25th, 2008 in Game Development

Hello there again =)

And thanks to everyone who helped me with my last problem.

Now I got a new problem actually :) I would like to do my character to regen hp over time.
I have thought of one way to do it:
I make an mc with 1 keyframe on frame ONE and 1 keyframe on frame 5. This will loop over and over again. Everytime that MC reached keyframe 5, my hp goes up by +1

Is there a more Actionscript-way to do it? =P

Response to: Doublejump. Possible to code? Posted August 25th, 2008 in Game Development

Woho! We did it. Thanks to everyone who have posted on this forum and helped me. We have now manage to code a doublejump. I will post the final result here. If you think that there is a easier way to do it - feel free to post it =)

onClipEvent (load) {
jumping = false;
djumping = false;
upkey = false;
}

onClipEvent (enterFrame) {

if(Key.isDown(Key.UP)){
if(!jumping){
vel_y = 15;
jumping = true;
upkey = false;
}
if(Key.isDown(Key.UP) && djumping == false && upkey == true){
vel_y = 20;
djumping = true;
upkey = false;
}
}

if (jumping == true) {
this.gotoAndStop("jump");
vel_y -= 2;
}
}

onClipEvent (keyUp) {

if (Key.getCode() == Key.UP) {
upkey = true;

}
}

Response to: Doublejump. Possible to code? Posted August 25th, 2008 in Game Development

WOW! This much help in just a few hours. Amazing...I am really amazed : D

I have read and analyzed what you guys read and it is very helpful + learning.

Now, I have come so far that my character do a doublejump (I guess), but it is hard for the user to control couse the both jumps will happen at the same time. Maybe if I change the DOUBLEJUMP.KEY to e.x. CONTROL, it would work. But that is an to easy way to do it I think (the result wont be good).

Someone said something about a VEL test. Any comments on how I should do it? =)

Doublejump. Possible to code? Posted August 24th, 2008 in Game Development

I have played games where it is possible to in the middle air, press the UP-key again and do a what it's called doublejump.
My guess is that this is not possible to do in flash, so I made a little try: it wont work tho. If you got anything to suggest I would be very thankfull.

if (Key.isDown(Key.UP) && !jumping) {
vel_y = 15;
jumping = true;
djumping= true;
}
if (jumping == true) {
this.gotoAndStop("jump");
vel_y -= 2;
if (vel_y<=-15) {
vel_y = -15;
}
this._y -= vel_y;
}
//here starts my try for a doublejump
if (Key.isDown(Key.UP) && jumping == true && djumping == true) {
vel_y = 15;
djumping =false;
}
if (djumping == true) {
this.gotoAndStop("jump");
vel_y -= 2;
if (vel_y<=-15) {
vel_y = -15;
}
this._y -= vel_y;
}

Response to: Cant convert a my flashprojekt Posted August 24th, 2008 in Game Development

At 8/24/08 10:41 AM, andy70707 wrote: hang on, flash player 6 is flash MX, and MX 2004 was the first version to use AS2, I think. Unless he used mx 2004/8, but flash player 6 for some reason. Anyway, I see no reason why it shouldn't work, as the players are always upwards compatible, so something in flash player 1 would play in flash player 9, as long as the actionscript version is right. Other than that, all I can suggest is re-downloading it and changing it to flash player 8 before editing it, and then see if that works, because it might just be because you played around with it and the code didn't work. I found that exact example on flashit and it worked fine, so maybee try that one.

Hey again andy =)

Thank you for all the information. It was really usefull. I tried what you said, to redownload the tutorial andn change the settings before I start to mix with it. Tho, it was still the same result.

Now I have done a little bit of change. I have used some of my knowleadge learnt from this tutorial:
http://www.newgrounds.com/portal/view/14 6524
and placed it instead of the other guys jumping code. It worked perfectly.

Thanks again for all your help

Response to: Cant convert a my flashprojekt Posted August 24th, 2008 in Game Development

At 8/24/08 10:13 AM, andy70707 wrote: Its probably written in AS1. You can change it to run in flash player 8, but you have to set the actionscript version to AS1.

Thank you for the fast reply =))

I tried that. Both change it to 2.0 and 1.0 but nothing different happened.

Also, I asked the author what version of AS he used, and he said 2.0.

I have tried to mix with the jump variable but with no success. Got anything else that I could try?

Very thankfull.

Cant convert a my flashprojekt Posted August 24th, 2008 in Game Development

Hello everyone =)

I have spent much time reading and analyzing this tutorial:
http://www.kirupa.com/developer/mx2004/p latform_game.htm

I downloaded the source and tried to mix a little with it. I tried to change (setting -> publish settings) the flashversion from Flash 6 to flash 8 and 9. When I did that, my character cant jump in a proper way.

Do anyone know the reson for this?
I have talked with the creator of the tutorial (Nathan) but he doesnt know the answer for it.
The reson why I want it to be flash 8 is couse I then can use blur effects and such stuffs

Thank you so very much in advance =)

Response to: Newbie Question about HitTest Posted August 24th, 2008 in Game Development

At 8/24/08 08:06 AM, Peccator wrote: onClipEvent(load){
var touched = 0;
}
onClipEvent(enterFrame){
if (this.hitTest(_root.char) ) {
if(!dead && touched == 0){
this.gotoAndPlay("attack");
_root.hp.text -= 1;
touched = 1;
}
}else{
touched = 0;
}
}

That's the solution I always use.

Thank you so much for this help. I understand the code perfectly, it is nice written =) I tried it and it was still the same result. Tho, it came to my mind that I had done an GRAPHIC of the attack animation. In order for it to play I needed to do an MC (I dont actually know why).

Now it works tho with your code. I just made the 0 and 1 to true and false, couse that makes my mind clearer : D

Thanks so very much again

Newbie Question about HitTest Posted August 24th, 2008 in Game Development

Hello everyone!

I am working with a little game where I fight an enemy (who walks from the left and to the right).

The problem with my code is that when the enemy hits me it's attack animation wont play all frames (just frame one). I think it is couse im using a hittest which looks like this:

if (this.hitTest(_root.char) && !dead) {

this.gotoAndStop("attack");
_root.hp.text -= 1;

}

So, the enemy wont play his full attackanimation.

Anyone who got a answer to this?

I think I know what the error is. The enemy is hitting me all the time and will step to the attackanimation frame1 all the time hittest = true. But I don't know how to solve this.


Hello everyone =)

I'm kind of new in here, but I hope that my visits here will be both fun and learning.

Some weeks ago I read a lot of tutorials on NG, and I found them very very useful. Tho, I have checked the tutorials page up again (today), and as far as I remember there should be even more tutorials (many pages of tutorials if I remember correctly).

The link which I use is this:
http://www.newgrounds.com/collection/fla shtutorials.html

Might there be another one perhaps?

Thanks to all kind answers =)