PDA

View Full Version : Sneaking Game


Max
01-13-2007, 04:15 PM
Hi, i was just wondering, if anyone knows how to make a game like the classroom ... im talking about, where there is a light , and if you go into the light for ... 3 seconds or more, you get caught. Because im putting together an engine for a game that im working on, and i really want to add this feature in.

Thanks In Advance

Matt
01-13-2007, 04:20 PM
Hey infact I did. *Goes to old photobucket account*
http://i17.photobucket.com/albums/b57/mattsflash/thegreatcheater.swf

Max
01-13-2007, 04:23 PM
how'd you do that?

Matt
01-13-2007, 04:26 PM
Well you have your basic movement and your getbounds hittest.
Then you simply animate the teacher moving and check to see if the teachers LOS is touching your guy using hittest and if it is have something happen.
Use simple hittest so when you hit the nerd guy a variable goes up. Use a bar to show the variable.
There's it all in words. Have questions about a certain part I can show code.

Max
01-13-2007, 04:28 PM
getbounds hittest ... whats that ... i dont got it ....

doomlord
01-13-2007, 04:43 PM
well your gonna have trouble but i understand, heres an example on say the teachers line of sight (LOS) sorry if it sucks, also this code is for first version as in instant lose
onClipEvent (enterFrame) {
if (this.hitTest(player)) {
gotoAndStop ("level2fail")
}
for 2nd version of The Classroom a simple way to do it is get the teachers line of sight, then put it on 30fps and make a mc inside the LOS. Then on first frame have it green then go to frame 90 and hit insert keyframe and have it red then put a (i cant remember which) motion/shape tween between them then add this, i think it might work sry if it doesnt
onClipEvent (enterFrame) {
if (this.hitTest(player)) {
play();
} else stop();
}
im really sorry if doesnt work but im sloppy at coding this morning
also i remember The Classroom and how hard it was on level 4 on 1 version

Matt
01-13-2007, 04:44 PM
walkspeed=10
walls.onEnterFrame = function() {//Handler
//walls is all your walls put into ONE MC
with (_root.hero) {
//all following code well be with the MC with the isntance name of hero
if (this.map.hitTest(getBounds(_root).xMax, _y, true)) {
//map is the instance name of ALL the walls in one MC in the MC called walls.
//SO it's like this: mai ntimeline->walls->map
_root.hero._x -= _root.walkspeed;
//move hero left by the varaible of walkspeed
}
if (this.map.hitTest(getBounds(_root).xMin, _y, true)) {
_root.hero._x += _root.walkspeed;
}
if (this.map.hitTest(_x, getBounds(_root).yMax, true)) {
_root.hero._y -= _root.walkspeed;
}
if (this.map.hitTest(_x, getBounds(_root).yMin, true)) {
_root.hero._y += _root.walkspeed;
}
}
}

Max
01-13-2007, 04:48 PM
alright, that helped me a-lot, now i just gotta start making the game ... and matt, for some reason ... i cant put boundaries everywhere in the game in making, for example, furniture, walls , when i select them all and turn them into one MC, then give it the AS u provided in ur other tut ... everything is still walkable through

Matt
01-13-2007, 05:03 PM
You need to have 2 MC's.
One called 'map' with all the walls and stuff in it.
Then have it inside one called 'walls'.

Max
01-13-2007, 05:05 PM
and i give both of them the same AS ???

Matt
01-13-2007, 05:05 PM
No put the code on the frame.

edit:And make sure your guy is called 'hero' and i nyour movement code he moves by using _x+=_root.walkspeed ect

Max
01-13-2007, 05:09 PM
so i make two different MC's... 1.the walls 2. inside of walls (except character) ... then i give the frame one AS, and no AS to the MCs?

doomlord
01-13-2007, 05:27 PM
wait max your saying my code worked? woah...
I might work on a game like this except different idea as in not the whole "classroom" thing.

Matt
01-13-2007, 05:30 PM
Ok step by step.
Add the code I gave you to the frame.

PAY CLOSE ATTENTION.ITS EASY TO MESS UP HERE.
Ok lets get started by making are buildings, walls, people ect that you don’t want to be able to walk through.
Now be careful and select ALL your buildings and stuff that you don’t want to walk into but not your guy and covert them into ONE movie clip.
Give it the instance name of 'walls'
PAY ATTENTION!
Ok now double click on the new mc of your buildings and then once again select them ALL and convert to an MC but give this an instance name of map and there will be no action script needed for it. This is called putting an MC in another MC very useful.
Test the game now and you’ll find that you can’t walk through the buildings. If it didn’t work its cause you did something wrong now these aren’t that clear so you may have to reread this tutorial to get it right.

edit:If you want to see my entire RPG tutorial that I took that from:
See here (http://z8.invisionfree.com/Computer_Turret/index.php?showtopic=7)

Max
01-13-2007, 05:30 PM
No ... i didnt ... lol ... i said that helped a-lot ... lol but whatever ... Im basically putting together an adventure game ... it will be stick figures ... (sadly) ... and the game will involve Stealth missions, choose your own adventure ... etc ... its going to be a great game ... i just need to design everything first ... i really shouldnt be doing this project solo ... but NOBODY wants to be a part of this kinda thing ... especially if everyone hates stick figures... im just not that good of an artist, if I had the artistics, this game would be REALLY good ... but, the skills in drawing/animation i have now, will certainly do ... for the time being ...

Matt
01-13-2007, 05:32 PM
I'm just explaining the hittest.

Max
01-13-2007, 05:35 PM
kk

doomlord
01-13-2007, 05:36 PM
i could maybe help with some of the art
Here's some of my art it's just quick 10minute sketches and i got a good technique for doing a glowing object and it looks cool give me a min and i'll post the location
also matt you can use some of this artwork if you want or anyone i don't care just as long as you say who drew it heh also i like my chainsaw thing
http://www.mytempdir.com/1165566 is its location coz i jsut use mytempdir coz its only one i know but ill use deviantart next time
there not good but then there just quick 10minute drawings i like the grey/black bandana guy best

Max
01-13-2007, 05:37 PM
rlly? do you have deviantart or photobucket?

Matt
01-13-2007, 05:39 PM
Yeh.
http://computer-turret.deviantart.com/
My photobucket is super old and I don't use it anymore.
Feel free to look around in it though.
http://s17.photobucket.com/albums/b57/mattsflash/

Max
01-13-2007, 05:41 PM
matt ... do you have any .fla files that have the boundries put in them? like just a wall with a little moveable ball in the middle of the walls (boxed in) ... because i still cant get the darn thing to work ..

Matt
01-13-2007, 05:55 PM
I do indead.
This also have loop hittesting if your interested.
here ya go (http://www.kyujjistudios.com/nekohost/files/7/loop-hittest.fla)

doomlord
01-13-2007, 05:56 PM
i drew some of these guys when i was gonna do some stuff for knux but he never used it, in there theres just some people designs some glowing circles and a weapon or 2 (all i know is i put my chainsaw in there but its ****)
edit: its at http://www.mytempdir.com/1165566
also there pretty bad but if i took my time i could do better but i do alot better if i know specifically what im drawing

Max
01-13-2007, 06:01 PM
theres nothing ON that page doomlord ... and matt, thanks ... im going to try and build off of ur engine here ... I will be crediting you when i put the final product on Newgrounds or deviant art (matt)

doomlord
01-13-2007, 06:04 PM
really? ahh i'll fix it
hmm
edit: maybe try now coz it worked for me also i usually just do coding and little artwork

Max
01-13-2007, 06:07 PM
Alright, Matt ... would you happen to have a video tutorial of the boundaries on the internet ? because that would REALLY be useful, because i dont see how i can build off of this engine u sent me ... its too far into the actual development ...

doomlord
01-13-2007, 06:14 PM
Matt, one thing all games need...
A FREAKEN MINIGUN WOOOOOH!!!
just kidding but it would make it harder if an enemy had it
sorry i just watched a flash and it was retarded.... really retarded...

Max
01-13-2007, 06:18 PM
lol.. Anyways ... have u got the site workin again , so i can see ur arts?

Matt, i still cant get the boundaries to work, i feel like a retard right now ... because it really seems simple!

Matt
01-13-2007, 06:18 PM
Minigun, machine gun same thing...

edit:I'll make a super simple one for you.

Max
01-13-2007, 06:21 PM
alright, thanks

Matt
01-13-2007, 06:23 PM
Here ya go. (http://www.kyujjistudios.com/nekohost/files/7/simple-getbounds.fla)
doesn't get much simpler.

doomlord
01-13-2007, 06:24 PM
Change the rippers name and make a chainsaw called ripper, just saying need a close combat wep that doesnt suck (fists) also you could give it like oil and when you hold it it slowly goes down

Matt
01-13-2007, 06:27 PM
Well gas can get it's ammo.
What could I call the ripper? The worm?

doomlord
01-13-2007, 06:38 PM
hmm i'll think of a list of names also i can't believe you were gonna do a knife instead of a dam chainsaw in the first place!!!
The Bouncer
Ricochet
The-Awesome-Looking-Cool-Weapon-That-I-Like
The Bouncerer
The Matt
Bouncy Mcgee
Corner
Wall
thats bout all i can think of
also some good coders should all just team up and make a good game, i dunno i'm just having random ideas from watching unforgotten realms.

Max
01-13-2007, 06:40 PM
damn ... still cant get it to work ... heres the link to the .fla http://www.mytempdir.com/1165590

I have no idea what im doing incorrectly

Matt
01-13-2007, 06:42 PM
One little thing. You forgot to give the MC inside of the first one the instance name of map.

Max
01-13-2007, 06:43 PM
... Can you fix that for me ... because i dont understand what ur talkin about ...

doomlord
01-13-2007, 06:44 PM
keep trying also i've lately i've stopped learning in flash hmm

Matt
01-13-2007, 06:46 PM
Double click on your wall MC.
Now the MC you have in there. Click ONCE on it. Open it's properties panel. Give it the instance name of:
map

Max
01-13-2007, 06:47 PM
... which one? ... have u checked the .fla ?

Matt
01-13-2007, 06:50 PM
YES I CHECKED THE FLA.
Look at mine then at yours.

Max
01-13-2007, 06:53 PM
theres a MC called the map, and another one called MAP ... i dont get this ...

doomlord
01-13-2007, 07:13 PM
theres an mc inside another mc, simple for matt, kinda tricky for me and hard for you is probably the situation now. Also i'm gonna use matts tut to help me make a game, thanks man
Also Matt how do you have it so if 2 keys are down something happens because i've tried but doesnt seem to work, i dont need the whole code just what to put in the keypress area kinda heh (coz i wantrsprinting for a game)
also it would help me if say i wanted to have my guy go down diaganol right and not have him rotate... yeah man any help is appreciated

Max
01-13-2007, 07:25 PM
wtvr ... ill look into it more in the morning ... Robocops on tv, and i wanna watch, goodnite

doomlord
01-13-2007, 07:34 PM
whatever also i'm trying (but have no luck yet) about easing with actionscript because i have the rotation for my game yeah but i just cant get easing in and with it it would be alot more realistic i found a tut somewhere but forgot where it was

Malignus
01-13-2007, 10:51 PM
Dude, that's easy. I did this same thing for the Shadowling camp in Telepath RPG Chapter 1, and it took me all of five minutes to figure out. :) Just motion tween some people walking around with a little "view cone", have the player hitTest the view cone, and then call a function to increase the enemy's awareness of the player. Something like:

if (_root.EnemyMC.viewcone.hitTest(_root.PlayerMC._x, _root.PlayerMC._y)) {
sighted(); }

function sighted () {
_root.awareness++
if (_root.awareness>=50) {
_root.gotoAndStop("youLost"); }
}

Or, if you want to be lazy like I was, forget the function and just make the enemy notice the player the second he hittests the view cone.

doomlord
01-13-2007, 11:18 PM
nice idea but he wants classroom effect and 2 things
1. i never played telepath heh
2. he wants it to change color depending on how much time hes been "sighted", a noobie but maybe long way of doing it is making an mc inside the view cone then make lets say you want 3 seconds at 30fps then make 90 frames and have 1 long motion tween for color from green to red from 1-90 and make new layer called "whateva" then on frame 1 just shove a really long code like
onClipEvent (enterFrame) {
if (sighted = 2) {
gotoAndStop(2);
} else if (sighted = 3)
gotoAndStop(3);
}
}

don't bag me for it, i'm just explaining it to him in a simple way

Matt
01-14-2007, 05:19 AM
I just made the 'cone' change colors in a tween and had soemthing like

if(_root.hero.hitTest(this)){
this.play(
}else{
this.stop()
}
if(this._currentframe==10){
_root.gotoAndStop("You Loose")
}

doomlord
01-14-2007, 05:36 AM
i had something like that just he said mine didn't work oh well
i'm still looking for some more AS tuts but no luck yet

Matt
01-14-2007, 05:41 AM
If you want tuts you'll only find seperate tuts on the different parts. Most people don't like writting tuts any more hence all the tuts out there being in flash 6 below.

Max
01-14-2007, 07:31 AM
alright, im back ... still having problems with the boundaries ... but i am working on the classroom-like feature ... ill have to try some of ur codes soon .. lol

Matt
01-14-2007, 07:42 AM
I already told you what was wrong.

Ok on the main timeline you have a MC.
Now inside of it you have another MC.
This MC inside of the first. Give it the instance name of 'map' all lowercase.

Max
01-14-2007, 07:48 AM
... for some reason, it wont let me change the instance name ... i got two mcs that are using the same object... the room around the ball... i have one with the name of MAP , the other with the name of symbol 1 ... the one with the name of map, i just renamed its instance name to map... now what? it still doesnt work

EDIT: I somehow got it partially working ... i got boundaries now, basically theres a box around the little ball, and the ball can pass through 3/4 walls ... the bottom one ... heres the link to the streamed swf : http://i144.photobucket.com/albums/r190/xen_flash/movement2.swf

i lost the .fla file, because my flash 8 is running terribly today , and it wouldnt let me save

Matt
01-14-2007, 08:06 AM
Don't make your walls so thin.
Not the name of it. the INSTANCE name.
In it's properties panel not the library.

Max
01-14-2007, 08:07 AM
yeah ... i noticed that when i walked around the bottom line, i could enter back in through the same bottom one ... lol ... ill try the bigger walls rite ... NOW

EDIT: do i make one MC of the walls, then re-select the walls and make another MC, give the first MC the code u supported in the tut, then on the second MC , give it the instance name of : map ?

Matt
01-14-2007, 08:14 AM
I think so, yes.

Max
01-14-2007, 08:36 AM
Alright, i went step by step and did the following:

1. Made a ball in the middle of the screen.
2. Gave him the instance name of guy
3. Gave him the actionscript you provided in your tutorial (matt)
4. Made a box around him
5. Made a box around the box
6. Selected the two boxes (moved the guy out of the way)
7. Converted it into a movie clip
8. Named the movie clip Symbol 1
9. I went into the library, next to the symbol 1, double-clicked on the MC icon
10. Selected the entire boundaries again
11. Converted it into another mc, name: Symbol 2
12. gave Symbol 1 the Actionscript provided in your tut (matt)
13. I cannot seem to edit Symbol 2 ... (giving it the instance name of : map)
14. Without that, the boundaries will NOT work ,
15. How do i get the action screen up for symbol 2, it is not in the sidebar of the actions tab ... and i tried to click swap, but then Symbol 1 dissapears, please, how do i fix this ?

Matt
01-14-2007, 08:38 AM
NO!
NOTHING TO DO WITH THE LIBRARY
Double click on it ON THE STAGE.

Max
01-14-2007, 08:43 AM
alright, i re-did everything, but now, i cant find symbol 1 ... only symbol 2 ... i gave symbol 2 the instance name of map, but now i cant find symbol 1 in the action bar ..

EDIT: i found symbol 1, but its in the tab of symbol 2 (the map one) ... do you want me to re-submit the .fla file so u can see?

Matt
01-14-2007, 08:48 AM
I don't want to say this but maybe you arn't ready for this...

Max
01-14-2007, 08:51 AM
yeah ... i know i mite not be ready for this ... but i do want to try ... and learn from my mistakes .. i have been working on things like this for a long time now getting better and better at it every time i fail or succeed ... I just need to keep trying and get used to starting over ...

EDIT : the fla file is at : http://www.sendmefile.com/00495617


... im still having trouble, can u tell me whats wrong, and what i should to fix it? plz

doomlord
01-14-2007, 06:22 PM
you shoulda found somewhere and posted it as swf coz my download is slow lately
1. i couldnt test it because i kept getting error messages and
2. try not to be lazy like me and copy the EXACT code of a tutorial/person because i have seen those codes before
but fix it then i'll try to see how good it is

phdrummer
01-14-2007, 07:45 PM
i helped him alot and now the game is going to be something awesome. We're (I'm) working on a shooting system, which should work but doesn't. i may post a thread for that later.

doomlord
01-14-2007, 09:47 PM
Off topic
hmm i tried going onto deviantart and making account but says i got banned when i've only been there like twice just to look at games and i've never signed up...