FROGGER GAME (NEED HELP)

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
VIPER604
Newbie
Posts: 2
Joined: Sat Dec 06, 2014 11:54 am

FROGGER GAME (NEED HELP)

Post by VIPER604 »

So for my school project I have to create a video game. I chose the game frogger. So I have to use DATA arrays to make the images or sprites. I have the Image of Frogger, but I'm not sure how to get him to move in the directions needed. I can get him to move, but it keeps the image of the frog at his original position. So I basically get a bunch of copies of a frog all over my screen. I tried CLS, but i dont want to clear the rest of the stage. Any help would be appreciated. :)
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: FROGGER GAME (NEED HELP)

Post by burger2227 »

Are you using a sprite from a BSAVE image? There are a few ways to set it with PUT, but you may need to GET the background area where the sprite WILL GO first.

1) GET a square as large as the sprite at the position of the background the sprite will go and it will be saved to an array.
2) PUT the sprite image in that location using the upper left corner position only.
3) When there is a change in position, PUT the background back then GET the next background position(1).

Odd shaped sprites will need a mask to use over colored backgrounds.

See my Q-basics tutorial below, Chapter 13.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
VIPER604
Newbie
Posts: 2
Joined: Sat Dec 06, 2014 11:54 am

Re: FROGGER GAME (NEED HELP)

Post by VIPER604 »

So what exactly do you mean by the upper left position only? I have it in an array using the get. And if it is an odd shaped sprite. Do you have a link to your tutorial?
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: FROGGER GAME (NEED HELP)

Post by burger2227 »

GET needs box coordinates from both TLC and BRC. PUT only uses the TLC coordinates and array name with actions. Cannot be off screen!

PUT [STEP](column, row), Array([index]) [,{PSET|PRESET|AND|OR|XOR}]

The INTEGER array size would be the sprite box width * height for both arrays.

The Q-Basics link is in my signature below.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Post Reply