SAS modules

BlitzMax Forums/BlitzMax Programming/SAS modules

Scott Shaver(Posted 2006) [#1]
Here are my modules if anyone wants them.

http://www.scottshaver2000.com/forum/viewtopic.php?t=135

Sprite Behaviors AI (autonomus agents)
Playing Cards (for making card games)
Scrolling Tile Maps (for use with maps from my SAS Map Editor)
BitmapFonts (For loading and displaying bitmapped fonts like you see in graphics demos)


Scott Shaver(Posted 2006) [#2]
Fixed a bug in the sprite behaviors mod. The SetVelocityToVector method, it was setting the heading not the velocity.


Scott Shaver(Posted 2006) [#3]
new version is up, I fixed a bug with the image file path in the tilemaps module


gellyware(Posted 2006) [#4]
Thanks Scott, nice contributions


Scott Shaver(Posted 2006) [#5]
new version:

tilemaps: add code to update map position based on time.
	Field moveSpeedX:Float = 0 ' the number of pixels to move each second in the x
	Field moveSpeedY:Float = 0 ' the number of pixels to move each second in the y
	
	'--------------------------------------------------------
	' update the map position automatically based on time
	'--------------------------------------------------------
	Method Update(time_elapsed:Double)
		SetPosition(mapX+(moveSpeedX*time_elapsed),mapY+(moveSpeedY*time_elapsed))
	EndMethod


Sprite Behaviors: added new method to Path type to copy on path to another

	Rem
	bbdoc: make this path the same as the specified path
	EndRem
	Method CopyFromPath(npath:Path)
		wayPoints = New TList
		For Local wp:Vector2D=EachIn npath.wayPoints
			wayPoints.AddLast(CreateVector(wp.x,wp.y))
		Next
		curWaypointIndex = 0
		looped = npath.looped
		dir = npath.dir
		bounce = npath.bounce
		If curWaypointIndex>=0 And curWaypointIndex<wayPoints.Count() Then
			curWaypoint = Vector2D(wayPoints.ValueAtIndex(curWaypointIndex)); 
		EndIf
	EndMethod


sprite behaviors: Added new method to the Sprite type to check for collisions.

	'-------------------------------------------------------------
	Rem
	bbdoc: Determine if this sprite and the passed in sprite have collided.
	about: 
	returns: true if a collsion occured
	EndRem
	Method IsCollision(s:Sprite)
		If Self = s Return False
		'calculate the distance between the positions of the entities
		Local ToEntity:Vector2D = SubtractVector(s.GetPosition(),GetPosition())
		Local DistFromEachOther:Double = ToEntity.Length()
		'If this distance is smaller than the sum of their radii Then this is a collision
		Local AmountOfOverLap:Double = GetCollisionRadius() + s.GetCollisionRadius() - DistFromEachOther
		If AmountOfOverLap >= 0 Then Return True
		Return False
	End Method
		



Scott Shaver(Posted 2006) [#6]
fixed another bug in the tilemaps stuff. when saving the map for a second time the image filename got lost.


Scott Shaver(Posted 2006) [#7]
new version:

changes to the sprite behaviors module SpriteEmitter type:




Scott Shaver(Posted 2006) [#8]
new version: more SpriteEmitter changes