Post Reply  Post Thread 
Keep a sprite inside it's background.
Author Message
gooseisloose
Newbie
*


Posts: 21
Group: Registered
Joined: Mar 2010
Status: Offline
Reputation: 0
Last seen online:
10-07-2010, 02:50 PM
Post: #1
Question  Keep a sprite inside it's background.

I have a sprite object that I'm moving with the keyboard arrows. I added the sprite to a background and I was wondering if there is a built-in method in GTGE for moving the sprite and keeping it inside the background. Or would I have to implement my own method for this?

01-06-2010 01:35 PM
Find all posts by this user Quote this message in a reply
MetroidFan2002
Senior Member
****


Posts: 611
Group: Registered
Joined: Jul 2007
Status: Offline
Reputation: 0
Last seen online:
06-09-2010, 11:25 AM
Post: #2
RE: Keep a sprite inside it's background.

I think there is a method http://goldenstudios.or.id/products/GTGE...etToCenter(com.golden.gamedev.object.Sprite) setToCenter on the background itself that you should check out.

01-06-2010 10:15 PM
Find all posts by this user Quote this message in a reply
gooseisloose
Newbie
*


Posts: 21
Group: Registered
Joined: Mar 2010
Status: Offline
Reputation: 0
Last seen online:
10-07-2010, 02:50 PM
Post: #3
RE: Keep a sprite inside it's background.

I guess my question wasn't clear. I want to stop the sprite from moving off the background. Not stop the sprite from moving out of the background's viewport. The sprite needs to stay within the background.

02-06-2010 08:48 AM
Find all posts by this user Quote this message in a reply
gooseisloose
Newbie
*


Posts: 21
Group: Registered
Joined: Mar 2010
Status: Offline
Reputation: 0
Last seen online:
10-07-2010, 02:50 PM
Post: #4
RE: Keep a sprite inside it's background.

I figured it out. I was digging through the documentation and I found the class com.golden.gamedev.object.CollisionBounds. This does exactly what I need.


website | blog | youtube
12-06-2010 03:10 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Sprite sets and tile sets anywhere? St3v3 2 1,878 16-08-2010 10:06 AM
Last Post: hongchaguan
  PNG rendering and basic sprite animation Malkavian 5 737 04-08-2010 05:34 PM
Last Post: thewall
  Sprite animation Kell 2 396 30-07-2010 06:29 PM
Last Post: jwright
  Collisions with a non-rectangular sprite thewall 1 229 25-07-2010 08:03 PM
Last Post: MetroidFan2002
  Sprite rotating? asherwolf 4 388 24-06-2010 09:43 AM
Last Post: asherwolf

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: