Dark Bit Factory & Gravity
PROGRAMMING => Other languages => Yabasic => Topic started by: Clanky on December 07, 2006
-
I have started a new game... this time it looks like I will stick with it.
I have done the first level. You move around, collide with the walls, interact with the scenery.
I have made 6 enemies on the first level, and they chase you if they 'see you'...
It runs at a pretty alright speed, which is supprising because it has heaps of stuff to do... well... I will try and get it up here when I finish the AI and stuff so you guys can try out the first level.
The game is going to have the name 'Unresolved Client'
I don't know why, but I like the name - seems technical!!!
-
Is this something to keep you busy through the 35+C weather up there over Xmas? Better off with a couple of NT stubbies, a beach and a few mates :)
Jim
-
haha yeah! couldn't get closer to the truth!
I was going to go to Melbourne, but meh... lol
I've attatched the .txt
The first level is finished, with AI and all that stuff... I don't know if the AI is any good... but it seems to work.
bit... but I dunno... hope you enjoy the first level, and the looks of the 2nd level...
I fixed the bug where it wouldn't let me progress onto the next level... (old post)... I had ecount=enum+1 when it should have only been ecount=enumThis men't you couldn't get to the next level because you couldn't get the Enemy Count to 0! Duh! Stupid Mistake... well, this is a modified code... it has the looks of Level 2... it kind of has a story to it, lol! Just find it out...
-
That's pretty cool. Reminds me of an MGS clone that Sephiroth(?) on the old forums was working on. Looking forward to more levels.
-
Done almost all of level 2... I haven't been on the comp for awhile, so it took longer than I antesipated {spell check} lol...
I just need to finish the Enemy Collisions and Bullet Collisions... easily done... 5 min job! lol
-
Now this is good, Im interested in how the mechanics of the AI sight has been solved. Any chance of getting an explaination?
-
Well rain_storm, it is quite simple!
All YaBASIC does is see if you (the player) is in the sights of the enemy... note that this is a square denoted as 140 by 140, this is code as:
if (alert(i)=0 and plx>=(ex(i)-70) and plx<=(ex(i)+70) and ply>=(ey(i)-70) and ply<=(ey(i)+70)) alert(i)=1
If you do enter the sights of the enemy, then it alerts them as to that you are there... then, it desides if it needs to go up, down, left or right to get to you...
After it has done this, it is now tracking you down wether which way you go... simple?
Ahh, now for the shooting... this is also easy, just make it so that the enemy fires, and then waits (reloads) and then fires again... at you
::NB// Sometimes it fires away from you because the enmey is facing left* (therefore firing left*) but you are facing up*, therfore the bullet will miss you.
if alert(i)=1 then
if ex(i)<plx then:ex(i)=ex(i)+2:edir(i)=0:fi
if ex(i)>plx then:ex(i)=ex(i)-2:edir(i)=1:fi
if ey(i)<ply then:ey(i)=ey(i)+2:edir(i)=2:fi
if ey(i)>ply then:ey(i)=ey(i)-2:edir(i)=3:fi
if (ecount(i)=0 and eshot(i)=0) then
eshot(i)=1
efire(i)=1
fi
fi
if efire(i)=1 then
if eshot(i)=1 then
esdir(i)=edir(i)
esx(i)=ex(i):esy(i)=ey(i)
eshot(i)=2
elsif eshot(i)=2 then
if esdir(i)=0 esx(i)=esx(i)+12
if esdir(i)=1 esx(i)=esx(i)-12
if esdir(i)=2 esy(i)=esy(i)+12
if esdir(i)=3 esy(i)=esy(i)-12
ecount(i)=ecount(i)+12
setrgb 1,200,0,0
fill rect esx(i)-1,esy(i)-1,esx(i)+1,esy(i)+1
if ecount(i)>=250 then:eshot(i)=0:ecount(i)=0:efire(i)=0fi
elsif eshot(i)=3 then
ecount(i)=ecount(i)+12
if ecount(i)>=250 then:eshot(i)=0:ecount(i)=0:efire(i)=0:fi
fi
fi
::NB// The code is all in FOR I = 1 TO ENUM, and ends with NEXT I
Hope that helps, if you have trouble undestanding my hard to understand instructions, then just ask me which bits you need help with.
-
Beautiful in its simplicity. Do you mind if I borrow this?
-
No worries!
-
Wow, must think of a way to finish this!
-
Not sure if I want to finish this... hmm...
Philosophy: "why does this always happen?"
-
Don't rush it just to finish it whatever you do. Have patience man it will be all the better for it when you make a final release. Sometimes I really get into a new program so I leave something else unfinished for awhile but when I come back to it I add somethin else to it, put a new spin on things, and fill in some of those missin gaps that I want in there. It makes it more fun code.