The VG Resource

Full Version: The GameDev Lounge 00000011
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
It's a bit hard to tell how the bits of code are related. Where these checks are being made can matter as well. I assume all of it's in the same .as file, could you upload or post it?
Well here is the code all together.

hero.gotoAndStop('still');

var Key:KeyObject = new KeyObject(stage);

var dy:Number = -3;

var gravity:Number = 1;

var canJump:Boolean = false;




stage.addEventListener(Event.ENTER_FRAME,onenter);




function onenter(e:Event) :void{

//Jump
dy+=gravity;

if(hero.y>300){

dy=0;
canJump=true;

}

if(Key.isDown(Key.UP) && canJump) {

dy=-10;
canJump=false;

}

hero.y+=dy;


//Character Movement
if((Key.isDown(Key.DOWN)) && (Key.isDown(Key.A))){
hero.gotoAndStop('Dattack');
}

else if(Key.isDown(Key.RIGHT)){
if (Key.isDown(Key.SHIFT)) {
hero.x+=10;
hero.scaleX=1;
hero.gotoAndStop('run');
}else {
hero.x+=5;
hero.scaleX=1;
hero.gotoAndStop('walk');
}
}else if(Key.isDown(Key.LEFT)){
if (Key.isDown(Key.SHIFT)) {
hero.x-=10;
hero.scaleX=-1;
hero.gotoAndStop('run');
}else {
hero.x-=5;
hero.scaleX=-1;
hero.gotoAndStop('walk');
}

} else if(Key.isDown(Key.A)){
hero.gotoAndStop('attack1');
} else if(Key.isDown(Key.S)){
hero.gotoAndStop('attack2');
} else if(Key.isDown(Key.DOWN)){
hero.gotoAndStop('duck');

} else{
hero.gotoAndStop('still');
}if (hero.y < 300)//Air Movement
{
if (Key.isDown(Key.A))
{
hero.gotoAndStop('attack1');
}
else if (Key.isDown(Key.S)){
hero.gotoAndStop.('attack2');
}else
{
hero.gotoAndStop('jumping');
}
}

}
First off, if you could put that between code tags it would look a bit nicer. I copied it into Notpad++ to read though.

I did notice that when pressing S in midair, you have

Code:
hero.gotoAndStop.('attack2');

Looks like you accidentally put a typo before the parentheses. You should've seen an error for that.

As for pressing A though, not sure what the problem would be. Maybe there's something going on in the "attack1" frame itself? Does it have any code?
Hmmm, which language is that?

I have a test scene to show from my own fan-game. I plan to use this stage solely for debugging. The game is far from playable and likely will be for a while.

[attachment=5968]

I'm using Unity 5, but most of the game runs on the C# implementation. Also attached are some tests: lighting (Kongo Jungle) and particles (smoking lava in Bowser's Castle).
this thread is FULL of amazing stuff good job guys!! VERY inspiring.

How do I get into gamedev
(01-08-2016, 08:02 AM)Raccoon Sam Wrote: [ -> ]How do I get into gamedev

Can't tell if this is a serious question due to the lack of a question mark but

If you mean the programming aspect of gamedev, snoop around and see which language you think fits you. Ask people, look up stuff, look at demos and examples and tutorials. Think about what you want to do and which language will do that. Be warned, lots of people try and start off with C/C++ and while that's possible, it's literally the hardest language out there (because assembly languages really don't count). I would highly recommend starting off with anything else, and only going into it if you really need or want to. It's all-purpose but that also means it's a royal pain to understand, especially as your first language.

But yeah, choose something and then just practice. As with anything, start off small and work your way up. Do "Hello World", then make a calculator or lottery app, and follow some tutorials. Get the hang of coding, slowly learn all the basic stuff you need to know, and figure out how to find the stuff you don't know. A word of advice; you will never ever remember everything in your head. Stuff like syntax and such you'll just get used to, and over time you may remember some commonly used functions, but you will forever and always be looking up stuff. Everybody does and it's a necessary skill. Either using the language's official reference or just Google, be prepared to spend a lot of your time looking things up because you'll constantly be learning. And you'll always go back and re-read the description of that function you only use once every 3 months.

^All of this is just a quick "getting started" introduction to programming. Just my opinion though, so yeah. Take from it what you will.

I also wrote it at 2:30am so
Yeah it was a serious question –  I know some Javascript (and I love it), some Python, I don't want to learn C#, C/C++ seems difficult.... but maybe the truth lies in learning any language, no matter how stupid or obsolete, just so you can wrap your head around the basic principles of programming. I mean, I understand Closures and Loops in Javascript and that alone makes me confident I wouldn't have problems understanding their concepts in another languages. But I digress.

Maybe there's a Javascript game engine out there
C# is actually very apart from C/C++, I'm not sure why the name is related. I've dabbled in it a bit and it's much higher level so isn't as bad to get the hang of.

But yeah, if you have already done some Javascript and Python, even though those are both pretty different from most compiled languages, it does already give you a head start. Personally I wouldn't recommend them for game development, maybe that's just me though.
I actually meant those as two separate things; I don't want to learn C# AND I hear C and C++ are difficult.
And yeah obviously js isn't meant for game Dev but it could be a fun exercise. I know the blender game engine can do Python bindings at least.
Putting out a suggestion first; try learning Game Maker first. The code GM uses is like C but simpler. I know a few people who code in GM.
(01-08-2016, 02:16 PM)eureka Wrote: [ -> ]Putting out a suggestion first; try learning Game Maker first.  The code GM uses is like C but simpler.  I know a few people who code in GM.

Thanks but I'm a Mac user  Very Sad
I did download Godot and it looks really fun though. I'll try to whip something up in the coming months.
game maker studio works on mac now, so that's not necessarily an issue anymore
(01-12-2016, 09:42 PM)Kitsu Wrote: [ -> ]game maker studio works on mac now, so that's not necessarily an issue anymore

Maybe I'm missing something but it says that I have to pay 150 dollarydoos to use the software, and that's something I'm not comfortable with.
Unless you mean the Legacy version of GM7 from 2012, which still costs twenty bucks.
You might want to give Stencyl a gander. I've never used it myself, but the free version can publish to web and it looks fairly friendly to at least get started with making games.


With Piks permission, I did another demonstration. Sorry about the framerate, my laptop just can't handle recording software...
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20