CP - Alien Breed Remake - 3

Miscellaneous Forums/Blitz Showcase/CP - Alien Breed Remake - 3

I like the progress so far!

I'm currently working on some music for this :)

Yeah, music'll be great. What kind?
We definitely need:
- Slow scary (think AVP menu music(?))
- Intrigue
- Scared & confused rock!!
- Full out rock music, great whilst shooting alien skull.

Ahah! Thread 3! Ignore my last post on thread 2!

I'm not going to be able to do any more on this for the next 2 weeks as I'm off on holiday! I'm kinda pissed off with this as I'd love to be involved over the next couple of weeks but Spain is a-calling! And given the choice... Spain wins!

Caff, I've written a piece of title music that's perfect for this so if you want to do ingame/inceidental music that'll be cool.

Hopefully by the time I get back I should have title graphics and stuff as I've emailed a bunch of random people who are into the whole alien theme who do amazing fan art (see previous thread) and pixel art for graphics...

Who knows what emails I'll have when I get back and who knows what this game will be like!

Anyway... Have fun guys... Keep these threads going as we're potentially writing the best blitz game ever here!!!

Will this do for some in game music? I did it a little while ago now.

Rims, Sent you a bit of music, and a bunch of other emails! This really needs the front end though.

Have fun on holiday rob. Don't burn, baby.

Antony, how's the lightmapper coming along?

Cheers man! Time for bed!

Perturbatio, Rob, Caff: very nice, guys! We've got fantastic music coming out of everywhere. If nothing else, this game'll have the best soundtrack. We'll have to release it on CD.

we need to have some way of adding in more tiles to the editor without messing up any previously created maps.

Aren't the tiles numbered sequentially. So appending the tile image won't mess up the previous tiles, will it? Or will it? I'm not sure.

Sorry Perbuti (arghhh!!) Perturbatio (copy + paste ;) ) - can't download that, I don't know if my browser is broken though...

Ok I'll do some moody in-game stuff, with a sort of cheesy techno-rock feel to it. I was digging about on some alien-breed fansites and found some classic Bjorn Lynne Amiga MODs :D

.MOD or .OGG/MP3? Depends whether we want to keep file sizes down. What do you think?

Yeah, you could do it that way, I was just thinking about keeping all similar tiles together.

Mark, coffeebean, perturbatio, and anyone else involved, do you might if I put your email addresses in the readme.txt? Rob advised we should have a "don't use any media or code without permission of the author(s)" section in the readme.

I was just wondering whether you all wouldn't mind me adding your email addresses as I feel a bit egotistical just adding mine and rob's seeing as we all worked on it.

put mine in as me@...

oh yeah, enjoy yer holiday Rob :)

I'd prefer to go with MOD for that retro feel. What does everytone else think?

pert, do you literally want me to put me@ or pert@? Ha! it's late and I'm confused!

me@

I don't do MOD's personally, never found a mod tracking program that was as easy to use as Acid Pro is.

I vote OGG, you can still get a retro feel by using older instruments :) Only problem is the file size?

I'll lay down some grooves, if we decide to go MOD/XM route I'll move everything over to Fasttracker II :D

Will be a bit of fun to boot that up again!

I like OGG too, file size might be a slight issue, but you can always make the music an optional download.

*EDIT*
Perhaps provide a MOD or two with the basic download and offer the extended media pack seperately

I agree. I've already seperated the next download into three: music.zip, media.zip and code.zip. Music's really a last minute thing we can always tweak. I think we should discuss the next few steps...

I think we desperately need some graphics (I've talked to a friend who can do us some) before we can really test and implement a new data layer on the map. That's unless we use place-holders. What do we need from the data layer...

- alien spawn points
- looping animation points (for lights, fans)
- script trigger points
- what else?

How complicated do we need the scripting to be? Do we need scripting? What about cut scenes? Too complicated? Simple dialogue? Exactly how will keys be used? What can your credits get you? When do we start writing the save/load functions.

For the editor, is it possible to add rooms en mass rather than individually draw the walls. What I mean to say is, select a tile corner and then drag a rectangle on the map to automatically create a room. This will make creating rooms/corridors/etc 1000% easier. Perhaps a rectangular fill with the current tile?

As rob, our fearless leader would say... discuss.

Scripting: some sort of simple scripting would be beneficial rather than hard coding all the levels, but I wouldn't know where to start.

Spawn points: slightly on this subject, it would be good to have the aliens bursting out of the walls, floor, or corpses etc.

Got to admit - seeing the Blitz community working together like this warms me cockles! Awesome stuff! Keep it up!
Wish I had some time to chip in that's all :(

warms me cockles


eeehhh... naughty! ;)

Tracer

- alien spawn points
- looping animation points (for lights, fans)
- script trigger points

Because we're just using integers for the map layers I think we can cram all of this into one additional layer.

I don't think there would be (m)any cases where you want a light, fan, alien spawn and trigger all on the same tile.

Therefore you could have just a bunch of values that mean different things. eg. 1 = Regular alien spawn, 2 = Face hugger spawn, 3 = Regular alien out of the ground, 4 = fan, 5 = fan sound (because the fan is 4 squares big you could have the fan sound next to the fan graphic) etc etc.

Also, I'm not a fan of aliens re-spawning, I like being able to clear out a level and make parts of the level clear. That's just me though, and I think it seems more realistic too.

Scripting... What do you want the scripts to do? Would this be like Objective 1, 2, 3 etc Ie Destory this object, pick up this object etc, if it's as simple as that it would be very straight forward. The fact the to destory object x means you have to adventure through the level open doors solve basic "need key x for door y" puzzles I think keeps the scripts/objectives simple but the game engine nice and rounded.

What can your credits get you
Guns, lots of guns.

Health packs, armour?, keys, clips.

The drag and drop room editor sounds great, probably easier to implement by hitting 'r' for the start point of a room (top left) then hitting r again for the end point (bottom right).

Regarding the tiles there are a few blanks in there and I used up a few spares by creating shady tiles, if this light mapper thing get involved the shady tiles will be pointless. There's no reason not to just keep adding to the tile set at the bottom. It may be worth splitting the transparant top layer tiles from the base tile set?

Exactly how will keys be used?
As I've said, on the data layer we could set a security level of a door, therefore you can pick up a security pass that will allow you through several doors, as we've got the vis in we need to split the level up a lot so having 1 key 1 door is just too clunky. Of course you'll still have red, green and blue keys etc for speicalised doors.
When do we start writing the save/load functions.
I think if there is a save you should only be able to save inside the intex systems, maybe saving will cost you money to stop you saving too often?
But I think you should only save at the end/beginning of each level. Of course this is the easiest solution as you don't need to store the positions of all the aliens, alien states, etc etc etc.

I think the next major jobs that need to be achieved are improving the collision detection with player/alien, bullet/alien, alien/player, alien/wall and player/wall.

Get the credits in (should take about 5 minutes to add a graphic and a type of credits) of course share credits needs to be taken into account with 2 player option.

Just a thought here, if we're having different guns, are we having different gun graphics? If so would it not be better to seperate the player from the gun?

Here's some music I made today for the project.

Free for anyones use just give me credit! ;)

It's in .mp3 format...if someone tells me how to ogg things I'll ogg it ^^

[Edit] See below it's been ogged!

Just knocked up a quick and simple graphic for the money:


Just a quick 'hack' to see how the players would look with half the frames of animation is:

	; animation frame control
	If move
		pl\fpause = (pl\fpause+1) Mod 10
		If pl\fpause = 0 Then pl\frame = (pl\frame+2) Mod 15
	EndIf


I think it looks fine (athough a little jumpy as it's 15 frames so doesn't divided by 2 easily! but that can be sorted), and I think adding the extra rotation animations would look much better. Likewise with the aliens too.

This function would need to be changed to:
Function dirdif(angle1,angle2) 

a= ((angle2 - angle1) Mod 16 + 24) Mod 16 - 8 
If a<0 Then a=-1
If a>0 Then a=1
angle1 = angle1 + a
If angle1>15 Then angle1=0
If angle1<0 Then angle1=15

Return angle1
End Function
to deal with 16 frames of rotation rather than 8.

Probably a couple of other bits will need changing too, hopefully not too much though. Oh, there are a bunch of sin(angle*45) scattered around alien.bb and player.bb which would have to be sin(angle*22.5).

Anyway, I'm not suggesting putting any of this in until the media is changed, but I think it'll be an improvement.

Any thoughts on this?

It's in .mp3 format...if someone tells me how to ogg things I'll ogg it ^^
I assume you've got it in wav format already and converted it to MP3, if you go to http://www.vorbis.com/ and download oggdrop. Then just drop your wav onto oggdrop, you could probably get away with putting the quality virtually at the bottom end of the scale until we're ready for release.

Perturbatio, the alien blood splat in that tile set can go now as it's not used.

I don't know how far you people are going to take this (great!) project and how faithfull you will be with the original Alien Breed series but I have some ideas. Problem is that I haven't programmed in Blitz for about 2,5 years so implementing it myself will be kind of a problem... (I am following the progress in the hope to learn from you guys and maybe create some code and/or graphics myself)

Maybe you can do something with this, I think it's kinda cool:

1) elevators like in the original Alien Breed, but also the possibility to use the acidblood of the aliens -by shooting them 'on the right tile', to create a passage to a lower level of the 'building'.

2) moveable objects. Barrels for example, to block a pathway for the aliens.

3) some explodable objects. (oilbarrels?) It's always fun to blow something up! Shouldn't be to much of them though.

4) isn't it strange to find money lying around all over the place? Money could be found in some kind of locker/dressingrooms, a safe or at dead bodies.

5) points 1, 2,3 and 4 can be of use to create some solutions to puzzles to advance to the next level or room instead of just using several keys with different colors.

Ok thanks Rob here's the .ogg on lowest quality.

This was composed and played on SY22 synth and TG77 expander module, drums on Audigy2...not a fruity loop in sight.

I may extend modify this piece...moving house atm so everything is up in the air -.- or in boxes ^^

http://homepage.ntlworld.com/jm.keay/alienb.ogg

Regarding the blood, I had considered making it damage the player when they step on it (perhaps making the damage taken relate to the amount of 'life' left in the blood).?

Depending on the tile beneath it there could be several actions with the blood. Burning through, damaging it, damage the player.

3) some explodable objects. (oilbarrels?) It's always fun to blow something up! Shouldn't be to much of them though.

The dynamic collision zones I implemented will allow for this.
Any object can be placed with a fixed number of hit points, you can then shoot the object until it is destroyed.

Feel free to put my email addy in there: mark (at) thetiffanys.co.uk

I hope to work on sorting the vis thing tonight, but I've also been thinking today about the comments on the map format. I think we can actually reuse the object layer, and cram everything in there (see Rob's post above that recommends 1 extra layer). What I'm thinking is that for each map we define a set of actions which have various properties:

Image: pointer to the image in the current tileset
Trigger: When to action the script (onenter, onaction (we need an action keypress), every N frames,ondestroy)
Script: the script itself

The editor then sets the current object layer to point to one of these actions instead of simply a tile.

The script for each action is a basic scripting language. Doors have a script that is "opendoor(keyrequired)" and operates as currently. Credits are "credit(100):removeme()". Spawn points are "createalien(type,x,y)". Documents found on the floor are "showdoc(blah blah blah"). Conversations are "showconv(player,how you doing?):showconv(president,are you coming on to me?):removeme()". A sound emitter is "sound(scratch)". A trap located near the scratching noise is "createalien(facehugger,10,10):setmap(10,10,objectlayer,0):removeme()" (i.e. remove the scratch sound from 10,10 as well as the trap itself).

If you understand that, please comment on it! I'll try to write up something better later tonight, but whilst I'm hacking the editor code, I may try to add an action definer and possibly get to amending the object layer...

Oh, and such an approach could do exploding barrels:

set the destructibility low so one shot does it.
set the image to the barrel image
set the action trigger to ondestroy.
set the script to "bigexplosion():removeme()"

Also, I agree with Robs point about re-spawning aliens: I'm not keen on them respawning with no explanation, and like to be able to totally clear a level. We could also reward players who do clear levels. I think all alien respawn points should be obvious and destructible. The scripting idea above could work with two tiles next to each other with actions.

Tile 1 @ 10,10: no image, trigger="onevery(10 seconds)", script="createalien(10,10,facehugger):sound(materialise)"
Tile 2 @10,11: image=Respawn cubicle, destructibility=50, trigger="ondestroy", script="setmap(10,10,objectlayer,0):removeme()"

Neat huh? (if you understand my ramblings that is!)

That sounds like a really good way of dealing with the events. And it's nice and expandable to any other future ideas. I like it. The parser could be a bit of a tricky one to write, but not too hard.

I think you might want some common scripts though, 'pick up object' [givetoplayer(player): removeme():playoneshot(itempickedup)] for example would be used a hell of a lot.

The parser can be kept simple - all commands separated by | symbol, all commands have brackets even if there are no params. There are certainly a whole bunch of common functions to implement, but most of them replicate stuff already there, so it's probably a case of rejigging some code (like opendoor, picking up keys and ammo).

The neat thing is that by defining action ids, they can be reused in multiple locations on a map. So once you've defined a key / credit / ammo / health / trap / whatever, you can reuse it multiple times on the map. So don't worry about having to write opendoor() or credit(100) for each and every door or credit that you place! And in terms of the editor, I'll be making it as easy as it is currently to drop these tiles on the map. (I'm thinking a whole new screen to define actions, then showing these in place of the existing tileset when editing the object layer).

More thoughts...

Currently we have a giveweapontoplayer function...

I think we need a sort of middleware function that deals with all objects so we have a

giveobjecttoplayer([objectno],[player])

This function will deal with if it's ammo, clips, credits etc, this way we don't need a special script for credits, keys etc they are all handled by the giveobjecttoplayer function therefore much easier to deal with. So to pick up ANYTHING be it credits keys weapons you would just have a script "giveobjecttoplayer(me,player):removeme()"

Thoughts?

I like that idea. (the whole scripting idea)

Yeah, like the idea a lot! Can't wait to design some levels!

Crew;

I could host the files on my website. If you want, it could at least be the .zips and music files. I have virtually unlimited space with my web host. If your interested please let me know. I can give you access to the FTP and anything else you need. Anything to keep this thing alive.

Chad

Nice track Shambler :)

How's this for a door open sound?


Currently we have a giveweapontoplayer function...

I think we need a sort of middleware function that deals with all objects so we have a

giveobjecttoplayer([objectno],[player])

This function will deal with if it's ammo, clips, credits etc, this way we don't need a special script for credits, keys etc they are all handled by the giveobjecttoplayer function therefore much easier to deal with. So to pick up ANYTHING be it credits keys weapons you would just have a script "giveobjecttoplayer(me,player):removeme()"



player should be superfluous, as it's whoever is interacting with the scenery. Anyway, two options: giveobjecttoplayer(me) or addkey(blue).

The former requires that the engine code knows that object id N means a blue key/red key/ammo/whatever. The latter doesn't. This separation of object type from id means that you can give stuff in different situations. For example if you hit the action key at a desk, you might find a key that gains you access to a secret room with loadsa ammo. With the first option, the engine code needs to know that the 'giving' the desk actually means give them a special blue key.

Plus, it's more readable. If you look at a map, and try to interpret lots of "givetoplayer" commands compared to seeing addkey(), addammo(), etc.

Admittedly, it means adding a new command to the scripter for every new type of object we're going to hand over. But is that so bad? You need to write new code in the "givetoplayer" handler if you do it the other way; it's just moving the code. And how many object types might we have? If we have an inventory system and loadsa objects, then I can possibly see this being useful, but only for non-core items. For example a fuse/wire/plug/whatever, as opposed to ammo/credits which shouldn't go in an inventory as separate items. In fact, even if we did that, you'd want givetoplayer(id) anyway, and that's no different to addkey() but less readable.

And in terms of mapping, you'll need to specify the command anyway when creating a new object type...

Also what happens on different levels? You are forced to keep the same action ids for all levels so that the engine code knows what to do with each. I suspect this could become a frustrating overhead.

Sorry if that sounds like a rant - it's simply all the thoughts I've just had on why my way is better. ;-P

I'm hardly likely to get all this up and running quickly (yes, I do plan to write this myself...), so keep throwing up ideas / reasons not to do it that way!

On that note: Rims can you update the todo list at the top to remove the editor todo and replace it with scripting, and stick my name against it? After my map update yesterday, you could stick 'improved map' up there too. And the biggies that need doing soonish:
Collision detection with player/alien, bullet/alien, alien/player
Improved collision with alien/wall and player/wall.

I like that idea. (the whole scripting idea)

Ta. B)))

Yeah, like the idea a lot! Can't wait to design some levels!
Ditto! I can see this being used for some really complex stuff if you want to. Even to the point of re-using the core engine for a Zelda style adventure... ;-)

Cool, that's fine by me I was just sticking another thought into the pot.

Right... Signing off for 2 weeks... Have fun peeps!

I was beginning to wonder if he'd ever go... ;-)

Okay, here's the vis update. You'll need a new *test.map* for vis to work now. (crappy temp host won't allow direct linking to zips)

Editor updated to place Vis blocks which essentially stop light at, i.e. you will see all up to and including the vis block. It takes a bit of thought to map out a level like this, and maybe impose a couple of niggly constraints on design, but it works. Hold CTRL whilst placing a collision block (dynamic OR static).

Fixed a bug in the destructible stuff - vis wasn't being applied when you destroyed anything other than a door (see example 'cell' in the second room you come to going right. I've used the old splat 'object' to represent what ought to be rubble of something...

And of course, the game engine itself has been updated to use the new vis.

Here are the changes...

editor.bb : in the main loop, replace the collision input stuf with
		;collision Layer
		If MouseDown(1) And activelayer = LayerCollision Then 
			;if left control is held
			If KeyDown(29) Then	
				map(xpos,ypos,LayerCollision)=czVisStatic 
			Else 
				map(xpos,ypos,LayerCollision)=czStatic			
			EndIf
			map(xpos,ypos,LayerHits)=-1
		EndIf
				
		If MouseDown(3) And activelayer = LayerCollision Then 
			;if left control is held
			If KeyDown(29) Then	
				map(xpos,ypos,LayerCollision)=czVisDynamic 
			Else 
				map(xpos,ypos,LayerCollision)=czDynamic			
			EndIf
			map(xpos,ypos,LayerHits)= lhDefaultHits ;see consts.bb for lhDefaultHits
		EndIf


and replace drawcollision function with:
Function drawcollision(xpos,ypos)

; sort out the block location based on pixel co-ord
xoff = Floor(xpos/32)
yoff = Floor(ypos/32)

For x=0 To 19
	For y=0 To 14
		Select map(x+xoff,y+yoff,0) 
		Case czStatic
			Color 255,0,0
			Rect (x*32)+7,(y*32)+7,18,18,False
		Case czDynamic
			Color 0,255,0
			Rect (x*32)+7,(y*32)+7,18,18,False
		Case czVisStatic
			Color 255,255,255
			Rect (x*32)+8,(y*32)+8,16,16,False
			Color 255,0,0
			Rect (x*32)+7,(y*32)+7,18,18,False			
		Case czVisDynamic
			Color 255,255,255
			Rect (x*32)+8,(y*32)+8,16,16,False	
			Color 0,255,0
			Rect (x*32)+7,(y*32)+7,18,18,False					
		Default
			;do nothing
		End Select
	Next
Next

End Function

consts.bb : add these two collision constants
	Const czVisStatic = 3
	Const czVisDynamic = 4 ;multiples of 2 are dynamic

map.bb : replace CheckVis with this, and remove the wall_vis_list type
Function CheckVis(x,y)
; This function determine the map vis for a player
	
	; add the start tile to the list
	v.vis_list=New vis_list
	v\x=x
	v\y=y

	; and start checking by looping through all tiles in the list that need checking
	Repeat
		; go through all 8 nearby squares
		For i=1 To 8
			Select i
				Case 1:x=v\x-1:y=v\y-1
				Case 2:x=v\x-1:y=v\y
				Case 3:x=v\x-1:y=v\y+1
				Case 4:x=v\x:y=v\y-1
				Case 5:x=v\x:y=v\y+1
				Case 6:x=v\x+1:y=v\y-1
				Case 7:x=v\x+1:y=v\y
				Case 8:x=v\x+1:y=v\y+1
			End Select
			
			; if it's on the map, we check it
			If x>=0 And x<=255 And y>=0 And y<=255 Then
				; if it's never been checked before (vis=0), check it.  otherwise, don't bother
				If map(x,y,LAYER_VISIBLE)=0 Then

					; set it to visible (including all solid blocks at the boundary of vis are themselves visible)
					map(x,y,LAYER_VISIBLE)=1
				
					; and provided it's not a vis stop, add it to the list of tiles to process
					If map(x,y,0)<czVisStatic  Then
						nv.vis_list=New vis_list
						nv\x=x
						nv\y=y
					End If
				End If
				
			End If	
					
		Next
		
		; set current tile to visible
		map(v\x,v\y,LAYER_VISIBLE)=1
				
		; eliminate this one from the list to check and move on to the next one
		Delete v
		v=First vis_list
	Until v=Null
		
	; now check all aliens (UNSURE if this should be here, or in aliens.bb?)
	For al.alien = Each alien
		If al\visible=0 Then
			If gettile(al\x,al\y,LAYER_VISIBLE)>0 Then al\visible=1
		End If
	Next
	
End Function

and in the DamageTile function, add CheckVis to the default case as follows:
			Default 
				Map(x,y,LayerObject) = 0 
				Map(x,y,LayerCollision) = 0	
				CheckVis(x,y)

And finally, in weapons.bb, update the select..case to include the two new constants as follows:
			Select Result
				Case czStatic,czVisStatic  ;bullet hit wall
					ok = False
				Case czDynamic,czVisDynamic  ;bullet hit destructible collision zone
					ok = False
					DamageTile(b\x,b\y,1);change to weapon damage so that different weapons will damage faster or slower?
			End Select

Phew! I'm not going to be around again until Sunday afternoon / evening (UK), when I'll hope to get somewhere with the scripting stuff. I'll need to hack the editor a fair bit then, so it'd be good to have any other updates any wants in by then. Ta!

I'm getting an array out of bounds error when using this. (I'm using the code in your zip download).
It occurs in GetTile and has an X of -1 I *think* it might be related to the CheckVis code, specifically at the check aliens section.

*EDIT*
the download code is missing the following from gettile:

	If x < 0 Then Return
	If y < 0 Then Return
	If x > 7552 Then Return
	If y > 7552 Then Return


I'm sorry I've been a little slow. I've been thinking about overhauling the movement method to a quite different car type. So that if you press left and right you change angles and when you press up you move forward. This allows you to substitute the mouse for aiming and also more freedom. Basically, this is the only way we can have less than 45 degree angle changes with the keyboard.

You can't really turn less than 45 degrees with the cursors as you only have up,up-right,right and no in between. But I don't like it. There's something about the simplicity of the four way movement that I'd prefer to keep. Also, it'd be a bitch to write a new version.

Therefore I've added an extra button (right shift). When held down keeps you at the same position but allows you to turn. This will allow you to take attacks from all sides without having to make cumbersome turns. What do you all think? Give it a try. It's in the new code. You'll need to download the new media as well. There's a music download but you don't have to download that to play the game.

What does everyone think about moving the entire game to BlitzPlus? We can make use of its low minimum requirements as well as extra graphics caps. I can't see any reason why we'd want to utilise any kind of 3D because we want to keep it simple.

Also, is it too late to move the entire editor to blitzplus as well? Does everyone working on the editor have blitzPlus? The standard interface would help a great deal. What do you all think? It might be a bit too far down the road to move it, but it might be for the best.

Chad, thanks for the offer but I'm alright at the moment. As soon as my site bandwidth runs out I'll come running. Thanks ;)

Mark, I like the script idea. Is there anything I can give you a hand with?

I don't have B+ so if it were changed, I wouldn't be able to add anything.

The shift thing seems ok to me.

Rims,

I'd prefer to keep it in Blitz3d as I don't have BlitzPlus - but I guess the consensis rules.

The scripting sounds pretty cool.

Ok, we'll stick with b3d. time to go to bed, I think. Yes, I'm quite tir...zzzzzzzz

Made a couple of changes to the collection of items and added health when collected:

Player.bb - Player_UpdateAll:
	; collect objects
	If gettile(pl\x,pl\y,2)>0

		;Determine what the player has collected
		; Don't add ammo to the collected list
		
		objcollect = gettile(pl\x,pl\y,2)
		collectable = True
					
		Select objcollect
			Case 1	;Ammo
				givePlayerAmmo(pl,15)
                                playoneshot(clip_pickup,pl\x,pl\y) ;Change once we get a proper sfx
				collectable = False
				
			Case 2	;Health
				Player_GiveHealth(pl,15)
				playoneshot(health_pickup,pl\x,pl\y)
				
			Case 3,4,5,6
				playoneshot(key_pickup,pl\x,pl\y)
				
			Case 9
				collectable = False
				
		End Select

		puttile(pl\x,pl\y,2,0)
		
		If collectable	
			p.pickedup = New pickedup
			p\player = pl\id ; allowing for multiple players
			p\obj = objcollect				
			
		EndIf
		
	EndIf


and add this function to Player.bb
Function Player_GiveHealth(p.player, h#)
	p\health = p\health + h
	If p\health > 100 Then
		p\health = 100
			
	End If

End Function


Also change the firing check after get input to stop firing animation from processing when you have no ammo:
	If Firing=True And (pl\clip>=0 And pl\ammo>0) Then
		If MilliSecs()>Pl\IsFiringTimer
			Pl\IsFiringTimer=MilliSecs()+25
			pl\IsFiring = Not pl\IsFiring
		EndIf
	Else
		Pl\IsFiring=False
	EndIf


We also need a couple of sounds:
* clicking when player out of ammo
* re-load sound when player collects ammo

Rims...

Ahhahah! Still not gone... About to leave but had to mention something here! I don't think there's any need to be able to point in the sub 45 degree position I just think it would look better for when you're turning and stuff, because of the turn code the player if you go from up to upleft the turn code will automatically make the player go through the inbetween frame.

Mouse aim sounds like a bad idea to me.

I was beginning to wonder if he'd ever go... ;-)
I'll get my coat... well... shades! Byeee!

I don't think he's actually gone. He's bluffing.

Rob's gone?

I see... an internet cafe somewhere on a sunny beach... :)

Quiet, he can hear us. If we're going to stick with blitz3d, then might we take advantage of the 3d caps? I mean, we could cut our animation frames by 75% by just using a single set and rotating them using something like spriteControl.bb. We could also add animations with alpha in them, alpha'd explosions, etc, etc.

I can't see much that would go against using 3d. Would it complicate it too much? Slowdown? Would it be worth it?

Your thoughts, all.

I wouldn't be able to play it if it used 3D...no 3D card here :/

Ignoring my crappy laptop, it would add some nice features like lighting, rotation and scaling.

Ok finished a track, runs to 3 mins 44, so fairly long - I've ogg'ed it @96khz

http://www.roastpork.co.uk/music/incendiary.ogg (2.6mb)

It's called Incendiary, hope you like it!

although I would like to get some experience of 2D in 3D there are issues with it, one minor one is that it would require a rewrite of the game.
The other is that it increases the minimum specs of the game possibly unnecessarily.

*EDIT*
I suppose one option would be to ensure the graphics part of it can be swapped easily, then a 3D version could be done simultaneously or added later.

Caff, I think that music will do nicely for more in game ambience.

I'm going to get my flatmate to reload a gun a few times for the SFX of reloading ammo (or perhaps for picking it up).

Thanks Pert (t..ur.. never mind), that's what I was aiming for as Rob said he had something ready for the titles etc. I might knock up a short 'end of level' and 'game over' loop as well. If there's anything else I can help with I'd be happy to contribute?

I had a look at tidying up the player control into a single set of code (previously it was split depending on the player):

	If control(pright,pl\id) And pl\x<7552 Then mr=True
	If control(pleft,pl\id) And pl\x>0 Then ml=True
	If control(pup,pl\id) And pl\y>0 Then mu=True
	If control(pdown,pl\id) And pl\y<7552 Then md=True
				
	If control(pfire1,pl\id)
		fireWeapon(pl,pl\dir*45)
		firing = True
	EndIf


The only thing missing is where we check the firing the 'force' parameter is no longer used, but it doesn't appear to cause any changes to the control of the player.

Centralised the player collision (walls and doors) into a single area:

Update Players.bb - Player_UpdateAll - replace 'Don't hit walls' and remove 'door objects 7 and 8, opendoor function needs to be replaced with animation stuff'
	; Object Collision (walls, doors etc)
	If mr Then
		If gettile(pl\x+playerradius,pl\y,0)=0 Then
			If control(pstrafe,Player_Count+1)=0 Then pl\x=pl\x+1
			move=True
		ElseIf gettile(pl\x+playerradius,pl\y,2)=7 Then
			If keycheck(pl\id) Then opendoor((pl\x+playerradius)/32,pl\y/32)	
		End If	
		direct=direct+"R"
	End If
	If ml Then 
		If gettile(pl\x-playerradius,pl\y,0)=0 Then 
			If control(pstrafe,Player_Count+1)=0 Then pl\x=pl\x-1
			move=True
		ElseIf gettile(pl\x-playerradius,pl\y,2)=7 Then
			If keycheck(pl\id) Then opendoor((pl\x-playerradius)/32,pl\y/32)	
		End If
		direct=direct+"L"
	End If
	If mu Then
		If gettile(pl\x,pl\y-playerradius,0)=0 Then 
			If control(pstrafe,Player_Count+1)=0 Then pl\y=pl\y-1
			move=True
		ElseIf gettile(pl\x,pl\y-playerradius,2)=8 Then
			If keycheck(pl\id) Then opendoor(pl\x/32,(pl\y-playerradius)/32)	
		End If
		direct=direct+"U"
	End If
	If md Then 
		If gettile(pl\x,pl\y+playerradius,0)=0 Then 
			If control(pstrafe,Player_Count+1)=0 Then pl\y=pl\y+1
			move=True
		ElseIf gettile(pl\x,pl\y+playerradius,2)=8 Then
			If keycheck(pl\id) Then opendoor(pl\x/32,(pl\y+playerradius)/32)	
		End If	
		direct=direct+"D"
	End If


Got to go to Cricket Training, but want to try and get the player/alien collision done when I get home. If anyone else want to do that, feel free!

Updated the alien animation code (so when we get some frames) to work - also makes the huggers point in the right direction now. Update the following:

Add the following field to the Alien Type:
Field frameTotal

Alien.bb - Update_Aliens:
		; animation frame control
		If move
			al\fpause = (al\fpause+1) Mod 5
			If al\fpause = 0 Then 
				al\frame = (al\frame+1) Mod al\frameTotal
			End If	
		EndIf


and update Alien.bb - Spawn_Alien:
	al\kind = kind
	Select kind
		Case 0: ; standard alien
			al\radius=20
			al\offset=32
			al\frameTotal = 1
		Case 1: ; face hugger
			al\radius=20
			al\offset=16
			al\frameTotal = 2
	End Select	


To get the hugger animating, I rotated each of the second frames 2 degrees - looked pretty good.

ok I've just finished recording a couple of reload sounds. My mic isn't brilliant, but I think it did ok.

I recorded a shotgun reload and then realised that the shotgun.wav has a reload on the end of it so I haven't added that in.

Very nice Perty. I've added your sounds and also your updates, Matt. I'm doing a little work on the editor to get ready for the scripting.

Let's keep it going, guys.

Rims, watch out - I started already! ;-)

I'll upload a couple of bits that I've done this evening and let you carry on (need sleep...)

I'll post a further message in a mo...

Ok, here we go. First, a new map *here* (with VIS this time, honest!) plus a separate .OBJ file. This currently defines all the objects. We could reincorporate it back into the main map in the future, but it seems easiest to keep it separate for now. If you have any of your own maps, you'll need to copy and name the file appropriately else you won't be able to load it into the editor.

I haven't yet implemented a thing in the engine - that's tomorrow's task.

The objects are EXACTLY as is - all I've changed is how they're defined. We'll need an object definer in the editor at some point, but for now, this sorts out the structure.

Okay, code changes! All changes are to editor.bb only. Hint to Rims for the next code update: It would be really neat if the engine and editor used the same map.bb to consolidate loading... ;-)

Replace load() with
Function load()

FlushKeys()
SaveWin = CreateImage(GraphicsWidth(), GraphicsHeight())

oldbuffer = GraphicsBuffer()
SetBuffer ImageBuffer(SaveWin)
Print
Print
Print
Print
Print
Color 255,255,255

FileName$ = Input$("Enter filename to load (without .map extension): ")
FileName$ = FileName$

If FileType(FileName$+".map") = 1
	filein = ReadFile(FileName$+".map")
	For layer = 0 To NumLayers
		For x=0 To 255
			For y=0 To 255
				map(x,y,layer)= ReadInt(filein)
			Next
		Next
	Next
	CloseFile filein
Else
	DebugLog "Filename does not exist: " + FileName$+".map"
EndIf

If FileType(FileName$+".obj") = 1
	filein = ReadFile(FileName$+".obj")
	NumObjects=ReadInt(filein)
	If NumObjects>0 Then
		Dim objectdef.objdef(NumObjects)
		For i=1 To NumObjects
			objectdef(i)=New objdef
			objectdef(i)\image=ReadInt(filein)
			objectdef(i)\trigger=ReadInt(filein)
			objectdef(i)\name=ReadString(filein)		
			objectdef(i)\script=ReadString(filein)
		Next
	End If
	CloseFile filein
Else
	DebugLog "Filename does not exist: " + FileName$+".obj"
EndIf

DebugLog "Loaded: " + FileName$+".map AND "+filename$+".obj"
FreeImage SaveWin
SetBuffer oldbuffer

End Function

replace save() with
Function save()
FlushKeys()
SaveWin = CreateImage(GraphicsWidth(), GraphicsHeight())

oldbuffer = GraphicsBuffer()
SetBuffer ImageBuffer(SaveWin)
Print
Print
Print
Print
Print
Color 255,255,255

FileName$ = Input$("Enter filename to load (without .map extension): ")
FileName$ = FileName$

fileout = WriteFile(FileName+".map")
For layer = 0 To NumLayers
	For x=0 To 255
		For y=0 To 255
			WriteInt(fileout,map(x,y,layer))
		Next
	Next
Next
CloseFile fileout

; save the object definition file
fileout = WriteFile(FileName+".obj")
WriteInt fileout,NumObjects ; number of objects
For i=1 To NumObjects
	WriteInt fileout, objectdef(i)\image
	WriteInt fileout, objectdef(i)\trigger
	WriteString fileout, objectdef(i)\name		
	WriteString fileout, objectdef(i)\script	
Next
CloseFile fileout

DebugLog "saved: " + FileName$+".map AND "+filename$+".obj"
FreeImage SaveWin
SetBuffer oldbuffer

End Function

In drawmap() update the drawing of the object layer (2)
If layer = LayerObject
	For x = 0 To 19
		For y = 0 To 14
			If map(x+xoff,y+yoff,layer)>0 Then DrawImage objects,(x*32),(y*32),objectdef(map(x+xoff,y+yoff,layer))\image
		Next
	Next
EndIf

and just after Dim map(255,255,NumLayers) at the top of editor.bb, add
Type objdef
	Field image%
	Field name$
	Field trigger% ; 
	Field script$
End Type
Global NumObjects%
Dim objectdef.objdef(NumObjects)

g'night!

Typo in consts.bb

change LayerClock to LayerBlock

in editor.bb add the following somewhere between the "if xpos > -1" so that collisions can be cleared:
		If MouseDown(2) And activelayer = LayerCollision Then 
			map(xpos,ypos,LayerCollision)=0
			map(xpos,ypos,LayerHits) = 0
		EndIf
		


Quick update: I'm in the process of updating the engine to use the new object file and basic scripts. I've got most things working (all pickups), but, erm, not doors. yet. Should have an update tomorrow.

For those interested, here's the areas that I've hit so far (so you can avoid them if poss!):

players.bb - significantly updated player_updateall and added RunScript and ParseScript and scriptitem Type
engine.bb - added new objdef array and removed old objects array
map.bb - replacement load, updated drawmap, added objdef type
hud.bb - amended drawhud select case criteria
----EDITOR----
editor.bb - mouse input code and an addition to the load code

Sounds good Mark - will wait for your update before continuing any work.

Should have a basic update tonight (have sussed how I want to fix doors after a good nights sleep). I'll probably revert the .OBJ file to a very basic ReadString format such that we can tinker by editing a text file until such time as we build a proper script editor in the editor. And after tonights update (ETA 12 hours from now) it should be much easier to add features through scripting without treading on each others toes...

In the meantime, feel free to make changes anywhere else in the code. I don't think I'll be taking a major swipe at any other functions than those listed above.

Some people are going to hurt me. I've *copied* the editor to blitzPlus. The blitz3d version still works the same way it used to. I've added some features to the blitzplus version and I've also included an exe for the people who don't have it. Notably, the features I've added are those quick-construction rooms I was talking about earlier. You can specify a template and create from that.

I've added your objdef to it although I haven't implemented anything using them. I'm not quite sure how. You can get everything from my sig, as usual. it's all updated including the music and gfx.

I feela bit bad. I was messing with blitzplus but then it got good and before I knew it I had a fully working version. Honestly if you all don't like it we can just move back to the blitz3d editor version. I don't mind. I just feel more comfortable writing editors in blitzplus's syntax.

Your thoughts?

B+ version sounds okay to me, as long as we can get a fully working editor compiled and ready to start mapping with soon. :)

Also can you update the music zip with my track and Shamblers
http://www.roastpork.co.uk/music/incendiary.ogg
http://homepage.ntlworld.com/jm.keay/alienb.ogg

Do you need space or bandwidth for these? I can help if you need it

Thanks!

The version we have now i *almost* ready to use for mapping. We just have to put in the scripting and we can go with some map making. I'll wait to see what mark has done with the scripting in the old editor before adding it to the new editor.

Try out the new editor. It's in the code.zip.

I have BlitzPlus, so provided no-one else objects, I'll move my code into the editor tonight. I don't see much of an argument against having the editor in BlitzPlus, provided we make an exe available for download too.

Agree that we're almost set to start mapping proper - the move to BlitzPlus may mean that I can knock up a basic object/script editor tonight too (I had been somewhat wary of trying to do this tonight in the old version, what with having to build a text entry thing...).

The one thing we probably ought to do if we're using B+ for the editor is make sure the map code is re-used between the two. Currently the load and drawmap code is repeated in editor.bb when it ought to reuse what's in map.bb. I'll try to sort this tonight too. (If we don't, then people are even more likely than currently of updating one but not the other)

Oh, and is it me, or have the aliens disappeared in the 10/09/04 update? They have for me, did I screw something up, or did Rob accidentally pack them in his suitcase?

(cue visions of Rob unpacking in Spain, only to be attacked by an facehugger, and run screaming into the hotel pool...)

The editor crashed on startup for me (editor.exe encountered a problem and needs to close).

did you extract the new media.zip to the dir? it contains the tile images it uses.

--
I think I might have turned the alients off temporarily to test something, and it must have stuck as the final version.
My face huggers still point the wrong way. It's my faulty code, and I thought after updating Matt's alien bits that it'd be alright, but they're still skewif.

The plus.bp in inc\editor\ is a bit messy as I've tried not to move stuff to other includes. As for the use of map.bb and others, I moved the load and save functions into map which the editor and engine both use.

Oh, by the way:
- Space is choose the tile under the mouse. Eye dropper type thing.
- ESC is quit.

Mark, you can use:
- openScriptWindow(o.objdef) to open a window with a textarea in it. Have a look at the code. It's more or less ready for the scripting.
This'll need to be added to the userlibs. It's got a mouseOverGadget function.

; Author: JimB
; Source: http://blitzbasic.com/Community/posts.php?topic=35005
; Requirements:
; - Additions To userlibs.
; USERLIBS ---------------------------------------
; .lib "user32.dll"
; api_GetCursorPos% (lpPoint*) : "GetCursorPos"
; api_ClientToScreen% (hWnd%,lpPoint*) : "ClientToScreen"
; ----------------------------------------------

--
Caff: Thanks for the updates on the music. I'm pretty sure I've already got those. Or do I??? yeah. But from where? All the music is currently packed in music.zip in my sig.

I've added the editor as a standalone executable in my sig. This will be the most updated version without code.

Oddly enough, having just downloaded the code, I find myself preferring the old editor. I wasn't expecting that.

At the very least, how do I move round the map now???

I'll make my updates to the code now - my editor changes since the previous lot are minor, so I'll make sure they work in both versions.

sorry you don't like it, mark. you move around with the right mouse button. Tell you what, to save bother, we'll just revert to the previous blitz version and leave the blitzplus version for now. It'll mean people without plus can help too. I felt a bit bad about it anyway.

I'll wait for your updates then update the version I have.

I like the idea, most of it's probably a case of getting used to it. I suspect you were hindered a lot by maintaining compatibility...but maybe we are best sticking to vanilla blitz. Who knows, it may even compile in blitzmax - how cool would that be for a first demo? ;-)

Anyway, here we go with tonights updates. Lots of them...

In editor\blitz.bb, at the top of the mouse input code, amend the main layer stuff to:
If xpos>-1
		If MouseDown(1) And (activelayer<>LayerCollision And activeLayer <> LayerHits) Then
			If activelayer=LayerObject Then
				If activetile<NumObjects Then map(xpos,ypos,activelayer)=activetile+1
			Else
				map(xpos,ypos,activelayer)=activetile+1
			End If
		End If


In engine.bb, remove these two separate bits of code
Dim objectname$(9)
and
; object names
Data "Ammo","Health","Generic Key","Red Key","Green Key","Blue Key","V Door","H Door","Alien Blood"
For n=1 To 9
	Read objectname(n)
Next
and add ClearVis() after the load() at the top

In consts.bb, I've moved the map and objectdef arrays in here from map.bb, plus type definitions
; TYPES and ARRAYS
Type scriptitem
	Field command$
	Field param$
End Type

Type objdef
	Field mx,my ; map coords
	Field image%
	Field name$
	Field trigger% ; see constants below
	Field script$
End Type
Global NumObjects%
Dim objectdef.objdef(NumObjects)

Dim map(255,255,NumLayers+1)

Const ScriptTrigger_OnOver=1
Const ScriptTrigger_OnTouch=2

And I moved in the LAYER_VISIBLE global from map.bb for neatness

In editor.bp, add an include for "inc\consts.bb"

In map.bb, add the following to the load function between the MAP and OBJ loads
	;load the object file
	For od.objdef=Each objdef
		Delete od
	Next

also, change all ReadInt or ReadStrings in OBJECT *load* and *save* code to ReadLine, and add the following new function
Function ClearVis()
	;set initial visibility for all tiles to none at all
	;we'll set initial player vis when we create the player
	For x=0 To 255
		For y=0 To 255
			map(x,y,LAYER_VISIBLE)=0
		Next
	Next
End Function


You'll need the new OBJ file, straight text for now, so I've just copied it in below: copy, paste and save as test.obj
11
0
1
Ammo
addammo(50)|remove(me)
1
1
Health
addhealth(10)|remove(me)
2
1
Key (grey)
addkey(1)|remove(me)
3
1
Key (red)
addkey(2)|remove(me)
4
1
Key (green)
addkey(3)|remove(me)
5
1
Key (blue)
addkey(4)|remove(me)
6
2
Door
checkkey()|opendoor()|remove(nearby)
7
2
Door
checkkey()|opendoor()|remove(nearby)
8
1
100 Credit
addcredit(100)|remove(me)
9
1
50 Credit
addcredit(50)|remove(me)
10
1
10 Credit
addcredit(10)|remove(me)


In players.bb, add the following
;-----------scripting stuff

Function RunScript(pl.player,obj.objdef,x,y)

	si.scriptitem=ParseScript(obj\script)
	While si<>Null
		Select si\command
			Case "addammo"
				givePlayerAmmo(pl,Int(si\param$))

			Case "opendoor"
				opendoor(x/32,y/32)

			Case "checkkey"
			   	If Not keycheck(pl\id) Then Return

			Case "addkey"
				p.pickedup = New pickedup
				p\player = pl\id ; allowing for multiple players
				p\obj=Int(si\param)+2
				playoneshot(key_pickup,x,y)

			Case "addcredit" ; TODO: Credits!

			Case "addhealth"
				playoneshot(health_pickup,x,y)
				p.pickedup = New pickedup
				p\player = pl\id ; allowing for multiple players
				p\obj = 2

			Case "remove"
				If si\param="me" Then puttile(x,y,LayerObject,0)

			Default:RuntimeError "Unrecognised command : "+si\command

		End Select
		nsi.scriptitem=After si
		Delete si
		si=nsi
	Wend

End Function

Function ParseScript.scriptitem(s$)
	s$=Trim(s$)
	p=Instr(s$,"|")
	p2=Instr(s$,"(")
	si.scriptitem=New scriptitem
	fsi.scriptitem=si
	While p>0
		If p2>p Or p2=0 Then RuntimeError "ERROR: Malformed script: "+s$
		si\command=Left(s$,p2-1)
		si\param=Mid(s$,p2+1,p-p2-2)
		s$=Trim(Mid(s$,p+1))
		si=New scriptitem
		p=Instr(s$,"|")
		p2=Instr(s$,"(")
	Wend
	si\command=Left(s$,p2-1)
	si\param=Mid(s$,p2+1,Len(s$)-p2-1)
	Return fsi
End Function

and replace Player_updateall with this:
Function Player_UpdateAll()

	ScreenX=0
	ScreenY=0
	Player_Count=0

	For pl.player = Each player

	move=False
	direct$=""
	mr=False
	ml=False
	mu=False
	md=False

	firing = False

	; get input
	If control(pright,pl\id) And pl\x<7552 Then mr=True
	If control(pleft,pl\id) And pl\x>0 Then ml=True
	If control(pup,pl\id) And pl\y>0 Then mu=True
	If control(pdown,pl\id) And pl\y<7552 Then md=True
				
	If control(pfire1,pl\id)
		fireWeapon(pl,pl\dir*45)
		firing = True
	EndIf
	
	If Firing=True And (pl\clip>=0 And pl\ammo>0) Then
		If MilliSecs()>Pl\IsFiringTimer
			Pl\IsFiringTimer=MilliSecs()+25
			pl\IsFiring = Not pl\IsFiring
		EndIf
	Else
		Pl\IsFiring=False
	EndIf
	
	; restrict players to the visible screen
	If pl\x-GOffsetX > GraphicsWidth()-32 And mr=True Then mr=False
	If pl\x-GOffsetX < 32 And ml=True Then ml=False
	If pl\y-GOffsety > GraphicsHeight()-32 And md=True Then md=False
	If pl\y-GOffsety < 32 And mu=True Then mu=False
		
	; Object Collision (walls, doors etc)
	If mr Then
		If gettile(pl\x+playerradius,pl\y,0)=0 Then
			If control(pstrafe,Player_Count+1)=0 Then pl\x=pl\x+1
			move=True
		EndIf
		tile=map((pl\x+playerradius)/32,pl\y/32,LayerObject)
		If tile>0 Then
			If objectdef(tile)\trigger=ScriptTrigger_OnTouch Then RunScript(pl,objectdef(tile),pl\x+playerradius,pl\y)
		End If
		direct=direct+"R"
	End If
	If ml Then 
		If gettile(pl\x-playerradius,pl\y,0)=0 Then 
			If control(pstrafe,Player_Count+1)=0 Then pl\x=pl\x-1
			move=True	
		End If
		tile=map((pl\x-playerradius)/32,pl\y/32,LayerObject)
		If tile>0 Then
			If objectdef(tile)\trigger=ScriptTrigger_OnTouch Then RunScript(pl,objectdef(tile),pl\x-playerradius,pl\y)
		End If
		direct=direct+"L"
	End If
	If mu Then
		If gettile(pl\x,pl\y-playerradius,0)=0 Then 
			If control(pstrafe,Player_Count+1)=0 Then pl\y=pl\y-1
			move=True
		End If
		tile=map(pl\x/32,(pl\y-playerradius)/32,LayerObject)
		If tile>0 Then
			If objectdef(tile)\trigger=ScriptTrigger_OnTouch Then RunScript(pl,objectdef(tile),pl\x,pl\y-playerradius)
		End If
		direct=direct+"U"
	End If
	If md Then 
		If gettile(pl\x,pl\y+playerradius,0)=0 Then 
			If control(pstrafe,Player_Count+1)=0 Then pl\y=pl\y+1
			move=True
		End If	
		tile=map(pl\x/32,(pl\y+playerradius)/32,LayerObject)
		If tile>0 Then
			If objectdef(tile)\trigger=ScriptTrigger_OnTouch Then RunScript(pl,objectdef(tile),pl\x,pl\y+playerradius)
		End If
		direct=direct+"D"
	End If

	; if you're not firing change the direction you're looking
	If Not firing
		If direct = "U" Then pl\targetdir=0
		If direct = "RU" Then pl\targetdir =1
		If direct = "R" Then pl\targetdir =2 
		If direct = "RD" Then pl\targetdir = 3
		If direct = "D" Then pl\targetdir = 4
		If direct = "LD" Then pl\targetdir = 5
		If direct = "L" Then pl\targetdir = 6
		If direct = "LU" Then pl\targetdir = 7
		
		If turndelay = 0
			pl\dir = dirdif (pl\dir,pl\targetdir)
		EndIf
	EndIf
	

	ScreenX = ScreenX + pl\x
	ScreenY = ScreenY + pl\y
	Player_Count = Player_Count+1
	
	; collect objects
	If map(pl\x/32,pl\y/32,LayerObject)>0 Then 
		If objectdef(map(pl\x/32,pl\y/32,LayerObject))\trigger=ScriptTrigger_OnOver Then RunScript(pl,objectdef(map(pl\x/32,pl\y/32,LayerObject)),pl\x,pl\y)
	End If
		
	If pl\health = 0 Then
		;TODO: Death of player
		
	End If	

Next
End Function

Finally, in hud.bb, drawhud function amend the select case criteria.
			Select Objectdef(pu\obj)\image
				Case 2,3,4,5:		frame=Objectdef(pu\obj)\image
				Default:			ok=False
			End Select

On that note, I think we need to worry about a 'proper' inventory sytstem, although I really don't like the idea of an RPG style inventory. To be discussed once we sort other stuff out methinks...

For reference, I've put together some notes on how I see scripting working below.
Scripting Design Notes
======================

Each map has a <mapname>.obj file that is simply a series of strings.
This can be tidied up later on, but allows us to edit objects / scripts
without actually having a script editor.

An object is defined once, and has a unique id (defined by it's position 
in the OBJ file.  This ID is then held in the object layer of the map.
Many locations on the map may reuse the same ID for common objects such
as keys, cash, ammo, doors, etc.  These share the same object definition, 
but the script can be run from many places on the map.

Special objects (such as conversations) are defined in the same way, 
but are generally used only once (although you might have a conversation
that you wish to be triggered by coming near a character, which might 
require several surrounding map tiles to point to the same object, but
the object then does a remove(all) to ensure it's not used again).

The idea is that if you want to add a new scripted object / event, you
simply update the OBJ file (by hand for now) with a new entry (don't
forget to up the count!), write the script in that entry, then load the 
editor, place the object somewhere (it should just appear in the palette),
save and run.  Once the scripting language is complete, that really is all
you'll need to do - well, other than draw an image for it.  Note that an 
image of 0 _should_ in principle be invisible, but I haven't tested it yet...
(may be useful for conversations / traps / scripted events occurring on 
entering a room).

FORMAT
======
Number of Objects, followed by the following fields repeated for each object:
Image       - the image in object_tiles that will be used for display
Trigger     - what will trigger the script to run (see below)
description - a simple description of the object!
script      - The script to run

TRIGGERS
========
trigger is one of:
1 - on passing over (collectable items, traps)
2 - on touching (doors, buttons on walls, intex systems)

SCRIPTS
=======
script is formed of a series of commands, all taking the format:
commandname(params)|commandname(params)

for example:
addammo(100)|remove(me)

Script commands implemented:
addammo(N) - adds N to the players ammo count
checkkey() - checks that they have a key, if not, the script stops
opendoor() - runs the old opendoor code as is
addkey(N)  - adds key type N
addhealth(N) - adds N health
remove(me) - removes the object that caused this script to run

TODO
====
CheckKey to look for a specified key type
addcredit(N) - adds N credits
remove(nearby) - removes all nearby objects of the same type (e.g. doors) and change opendoor?
remove(all) - removes all objects of the same type
playsoundonce(sfx) - play a specified sound effect and move sfx for health / keys into scripts
playsoundcont(sfx) - play a continuous sound effect.  No idea how we stop these though...
showdoc(text) - show a document on screen
showconv(x,y,text) - show a speech bubble at specified x,y.
createalien(x,y,type,anim) - create an alien - need creation animations
setcollision(x,y,value) - set the collision layer of the map directly
setobject(x,y,value) - set the object layer of the map directly
settile(x,y,value) - set the base tile layer of the map directly
other triggers, such as onevery(N) for sounds, anims and alien spawn points

Hope that's everything! From now on, scripting changes should just be changes to the scripts held in the OBJ file, and RunScript (although it might well call other existing code), plus a couple of minor additions to other bits of code to support other triggers. But for now, this is it!

Oh, and by the way, this wasn't as painful as I thought it could be - a testament to our combined abilities that the code was well structured enough to slot this in!

*gratuitous pats on backs all round*

Nice! Perhaps time for a new thread with latest builds at the top?

I think there may be something wrong with the checkVis() function. I added the clearVIS after the load("map\test"). This piece of code:
For n=1 To 20
	Repeat
		x=Rand(100,2000)
		y=Rand(100,2000)
		
	Until gettile(x,y,0)=0 
	spawnalien(x,y,n,Rand(FACE_HUGGER_ALIEN,STANDARD_ALIEN))
Next
; **

is looping infinitly because there are no valid points on the map to add an alien. Did you update this?

I feel 1000% better about sticking with the old editor. I don't even know why I changed it. I've moved the script functions and the script design notes to script.bb. I'm just going to read over the script notes later. it's looks very interesting. I'm sorry about the crap editor, I feel we're back on track.

I've removed any reference of the old editor and it still works great. I'd like to get the room creator in there still, as I think it'd save us a lot of time.

I won't update until I figure out the alien loop bit.

Rims,

Sorry about the alien code - you know when you make changes, and think you have uploaded everything! Doh!

Here is what's missing:
Function Alien_DrawAll()
	Local al.alien
	For al.alien = Each alien
		If al\visible Then 
			DrawImage al\image,al\x-al\offset-screenx,al\y-al\offset-screeny,(al\dir * al\frameTotal) +al\frame
		End If
	Next
End Function


Once we get some more frames with the Aliens, we just set frameTotal as required.

Thanks Matt. As soon as Mark replies I'll upload the code and start a new thread.

Rims, I didn't touch that bit of code. I can't think how any of my latest changes could have affected it...It's checking the collision layer for zeroes - which is correct, so I can't think why it's not working. What does the map look like in the editor? Have you somehow got a screwed up map where all the tiles are collisions? confused...

Aha, just looked at ClearVis() in my post above: make sure LAYER_VISIBLE is being defined by an included file. Because if it's not defined, it will be setting the entire collision layer (0) to zeroes, instead of the entire vis layer (6) to zeroes! (Although I still can't see why that would make the alien create stuff loop!)

Yeah, that fixed it. I'd just misplaced it. Player seems to have lost his animation. I've uploaded it anyway. Regard! A new thread!

Wonderfull, loved the orignal Team17 game. And this rocks :)

All the best,
Mikey F :)

Next thread