Jon
Newish
Posts: 4
|
Post by Jon on Jul 17, 2004 1:19:40 GMT -5
Need help with some things...
I was looking through the manuals that came with BASIC4GL, but could not find out how to do what I was trying to do. I sort of found an answer in one place, but was not sure as to what it all meant. So, I have a few questions:
1- I want to make a game with a mouse that can move around, and have the word START flash at the beginning of the program. The word START is a .png image file...I didn't want to write it in plain text. I also want it set up so that when some one clicks on the area that says START, it will begin the program. 2- To anyone has played a game like Collapse, or Snood, I am trying to set my game up so that when three of the colors come together the squares will disappear, but only when I click on them. 3- I want to be able to set up the game so that there are always a random set of colors in each row that is coming up—like Collapse. 4- When I click on something I want the mouse cursor to animate...e.g. I want a hand to close, or the fist to knock when I click on the mouse button in an area where some sort of action is possible, such as starting, or clearing away three squares that are the same color and next to each other.
These may seem like simple things to all of you master programmers, but I have NO idea how to do this, since I am new to BASIC4GL...in fact the only thing I have ever programmed in my life has been my TI-83 Plus.
Thanks for any help, Jon
|
|
|
Post by NoVaGene on Jul 17, 2004 5:57:09 GMT -5
Here's is a little life to help you kickstart in your exploration.... [ Introduction of writing simple games in basic4gl ] Take a look at the write-up from Tom in:- www.basic4gl.net/HowToWriteGames.htm[ Mouse demo ] basic4gl.proboards20.com/index.cgi?board=demo&action=display&thread=1086297664( Note: Skip the "console" part if you don't need it. I am not sure how to hide the mouse pointer though :/ ) For the hands animation, you'll need to create the images on your own. To understand how to do the sprite animation, go to basic4gl menu > help > sprite library. Go through the "ImageStripframes and LoadImageStrip (and LoadMipmapImageStrip)" section to understand how to use the sprite. In the image strip file C:\Program Files\Basic4GL\Programs\Data\Explode.png, you can see that it contains subimages of the explosion frames. [ Random Color ] Use SprSetColor (red, green, blue) where each of the values span from 0 to 1. See the Spite Library Guide. To generate a random number between 1 and x (inclusive), do:- Rnd() % x + 1 A simple demo as follows to show you:-
dim a# a# = (rnd () % 100 + 1)/100.0 'generate 0.0 to 1.0 locate 1,1:print a# swapbuffers()
[ Mouse click on region demo ] I've written a simple demo to detect mouse click on a defined region. Play around with the offsetX & offsetY values to suit the size of your start bitmap. See, basic4gl.proboards20.com/index.cgi?board=demo&action=display&thread=1090061371Hope these help! ...and have fun learning! Regards, Lucas Tan
|
|
|
Post by NoVaGene on Jul 17, 2004 5:58:45 GMT -5
I meant "lift" not "life" in my first statement... hehe! ;D
|
|
Jon
Newish
Posts: 4
|
Post by Jon on Jul 17, 2004 7:34:10 GMT -5
...I think it made sense eitehr way.
Anyhow; thanks for the help. I still have a few more questions though.
1- What if I already have the colored squares made as .png files--each square being a different color? 2- How can I get three of the squares to dissapear when I click on them?
Thank you once again for your help, Jon
|
|
|
Post by NoVaGene on Jul 20, 2004 9:59:21 GMT -5
1- What if I already have the colored squares made as .png files--each square being a different color?
I was wanting to show u how to get the color using sprcolor() but there's a problem which is unknown to me. See, basic4gl.proboards20.com/index.cgi?board=B4glhelp&action=display&thread=1090334829Alternatively, you can store the colors in an array corresponding to the squares so that you can use it to solve your question below. 2- How can I get three of the squares to dissapear when I click on them?
My suggestion is to use arrays for the squares and do a scan and if it fits your criteria, just do not plot them. Cheers! Lucas Tan
|
|
|
Post by NoVaGene on Jul 20, 2004 10:13:03 GMT -5
If you are not already familiar with arrays, spend sometime looking up the section "Array variables" in the language guide ie. basic4gl menu > Help
To add what I meant by scannning is, 1. loop thru the x,y coordinates 2. within the loop, check if the 3 squares are in line, diagonals, L-shaped, and all other permutations... (you may like to create a lookup table such that during the scanning, you chk only the patterns from the lookup table)
Some pseudos to illustrate:-
for y=0 to ymax for x=0 to xmax
if square(x)(y)=pattern(x)(y) then hit=hit+1 endif
next next
if hit=3 then hit=0 (remove the 3 squares) endif
Cheers! Lucas Tan
|
|