Small demo wanted

Blitz3D Forums/Blitz3D Beginners Area/Small demo wanted

Dicon(Posted 2011) [#1]
Although not new to Blitz Basic, I use it to have fun and keep my mind working. I have been using Blitz for many years and don't want to "move on" to another.
I have problems with memory, being A.T.HA. so Blitz is "A Good Thing" for me. I would like to see a simple way to move a small animated character around a maze. I can do the map based on an array. In the past I designed a map creator and could probably do it again. But getting the collision routine ( if array map(x,y)=x then no go sort of thing ) and a decent smooth character movement eludes me. I have tried for many days and I am feeling a bit lost. And fraustrated.
So, if you can point me to a demo that I can "take apart" to see how it works, that would be great.
Thanks

Dicon


6(Posted 2011) [#2]
Is this for 2D or 3D?


Dicon(Posted 2011) [#3]
I am thinking of 2D. Mostly... because I need to design games for mobiles and Ipads. The word here is design . Once Monkey gets going, I may change over to that. but need a way to design and consolidate my ideas and concepts BEFORE I go any further. If that makes sense?
Dicon


Charrua(Posted 2011) [#4]
hi, a handy function is curvevalue used to smooth transitions of any type: move, rotate and the like.

following is a simple test (turn on "Debug Enabled?"


newValue# = 50
oldValue# = 20
increments# = 15


For i=1 To 40
	oldvalue = curvevalue(newvalue, oldvalue, increments)
	DebugLog oldvalue
Next
WaitKey
End


Function CurveValue#(newvalue#,oldvalue#,increments# )
	If increments>1 Then oldvalue#=oldvalue#-(oldvalue#-newvalue#)/increments
	If increments<=1 Then oldvalue=newvalue
	Return oldvalue#
End Function



Juan


Dicon(Posted 2011) [#5]
Alas, it's the slowing down of the movement of the 2D character. I can't see where I could use "curve"
Ta anyway for responding.

Dicon


K(Posted 2011) [#6]
Read the code... it codes for a slowing down effect.Try it with a rect on a blank screen. Sorry if that sounds cynical 'cause I'm being serious.

As to colisions,something like this...?

If array(x-1,y)=wall Then LeftHit=True
etc.
etc.

{Remember to check for overflows}

Last edited 2011


Graythe(Posted 2011) [#7]
Look at 'maze' in the Blitz 2D samples directory.


Kryzon(Posted 2011) [#8]
Regarding that CurveValue function:
I'd much rather have something that mixes two numbers with a weight based on a float value that goes from 0.0 to 1.0, as it is a common function present in shader languages under the "Mix" name:
Function Interpolate#(A#, B#, Weight#)
	Return (A * (1.0 - Weight)) + (B * Weight)
End Function
Interpolates on values A and B based on the 'Weight' value:

- If 'Weight' is 0.0, returns A.
- If 'Weight' is 1.0, returns B.

Any weight in 0.0 ~ 1.0 will return a linearly-interpolated value between A and B.
I think this is more intuitive.

Last edited 2011


Dicon(Posted 2011) [#9]
Just read this after posting my own invention on the forums that uses a colour map to detect collisions that "lies under" the visible screen. It gives 16 options/responses per pixel and is fairly low in memory usage. Definitely a work in progress, but shows promise. But..making it work on a scrolling screen is a ******!
Dicon