QB64.org Forum
Active Forums => Programs => Topic started by: SierraKen on October 30, 2020, 02:28:03 am
-
I figured out how to use the background scrolling method on a picture and it works really good! I added mouse support and WASD keys as well as the arrow keys. Included is a NASA world topography map that I found on a NASA website tonight. I shrunk the map down a bit so it wouldn't be too large. Notice there's a white dot pointer as well as the mouse pointer. I almost deleted the white dot but I thought why not, it just adds another pointer and using the keyboard keys the map moves slower and more precise than the mouse. I had to keep the mouse at a fast speed so people won't keep having to take the mouse off the screen and start on the other side of the screen to keep scrolling it. In most situations you can keep the mouse on the screen the entire time this way. Tell me what you think, thanks. But imagine now the games and programs we can make with background pictures made using a graphics program or even a camera. :)
The zip file is attached below.
-
Never ceases to amaze me how far North Europe is in comparison to US!
Yeah, I get dizzy moving map with mouse and glad you left the arrow keys in but even they need some fine tuning so you can pin point a spot.
-
Thanks B+. I just fine-tuned it a little better. The mouse doesn't move as fast I believe and the arrow keys and WASD keys move more specifically. Here is just the code below. The map is in the .zip file above.
map
= _LOADIMAGE("worldtopoNASA6000x3000.jpg", 32)
playerSpeed = 1
_TITLE "The World - Using NASA Topography Map - Use Mouse, Arrow Keys or WASD Keys." mouseWheel = 0
IF mouseX
> oldmousex
THEN player.x
= player.x
+ (playerSpeed
* 8) IF mouseX
< oldmousex
THEN player.x
= player.x
- (playerSpeed
* 8) IF mouseY
> oldmousey
THEN player.y
= player.y
+ (playerSpeed
* 5) IF mouseY
< oldmousey
THEN player.y
= player.y
- (playerSpeed
* 5)
oldmousex = mouseX
oldmousey = mouseY
IF player.x
< 0 THEN player.x
= 0 IF player.y
< 0 THEN player.y
= 0
adjustCamera
CIRCLE (player.x
+ camera.x
, player.y
+ camera.y
), sz
, _RGB32(255)
camera.x
= _WIDTH / 2 - player.x
IF camera.x
> 0 THEN camera.x
= 0
IF camera.y
> 0 THEN camera.y
= 0
-
that's pretty cool.
i like that.
opens up programming possibilities.
-
that's pretty cool.
i like that.
opens up programming possibilities.
Yes did you see Fellippe's from which this was taken? He did a video demo on set up.
https://www.qb64.org/forum/index.php?topic=3139.msg124093#msg124093
Ken's Gold game inspired by that too!
A zoom in and zoom out with mouse wheel would be most excellent here.
-
I tried to do zoom but it would only work with what is on the screen, not the part that's not on the screen. I was probably doing something wrong. But my efforts on that have been erased. Anyone is free to mess around with this code too.