Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / 'Scrolling sprites' in a screen region

Author
Message
gonzales
11
Years of Service
User Offline
Joined: 16th Oct 2012
Location:
Posted: 22nd Oct 2012 02:41
Hi , there
Is there a way in example 'Scrolling sprites' to restrict scrolling
in a screen portion ?

TIA
gonzales
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 22nd Oct 2012 06:33 Edited at: 22nd Oct 2012 06:33
Hi Gonzalez ..

I'm not sure if I fully understand your question.

But something I did in my game was to restrict the movement (scrolling) of the sprite to only one axis ( X or Y )

So I used commands like this:




That tpe of example would start the sprite at x,y of 100,100 and move it by 10 pixels each loop until off the screen.

Hope that helps.

gonzales
11
Years of Service
User Offline
Joined: 16th Oct 2012
Location:
Posted: 22nd Oct 2012 16:16
Hi erebusman,

No. This is not what i meant !!
in 'Scrolling sprites' example a football pitch
scrolled up and down. ok ?
You see then whole screen ( 800,600) scrolled up and down.

What i want is ..
applying a command "like" SetViewRect( 20,20,100,100)
Instead of seeing the whole screen ( 800,600 ) scrolling up and down
i want to see a blank screen (800,600).
but in position (20,20,100,100)
I want to be hole that displays the background scrolling football pitch.

Any idea how toaccomplish his effect?


TIA
Gonzales
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 22nd Oct 2012 17:17 Edited at: 22nd Oct 2012 17:20
I have never used it myself yet but the setscissor command may help. Other than that there are various ways of achieving this effect. You could have an overlay sprite as a frame, and then scroll the football pitch underneath it using the spritedepth setting. The overlay sprite would hide the pitch scrolling underneath it. A single sprite would probably be sufficient for a football pitch, but you may want to tile it dependant on how close you want to be to the action.
Edit - I forgot to mention you can either scroll the sprite by repositioning it, or using the offsetcamera command. If you wanted to use the camera just fix the overlay sprite to the screen with the fixsprite command. That way the camera scroll will not affect the overlay.

Login to post a reply

Server time is: 2024-05-04 11:14:26
Your offset time is: 2024-05-04 11:14:26