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.

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 6th Aug 2010 22:05
Is there a way to set an area on the screen where a specific sprite is drawn, and if that sprite leaves that area, it's cut off?

Thanks,

TheComet

Mugen Wizardry
User Banned
Posted: 6th Aug 2010 22:26
if u mean it leaves the area and its supposed to stop, then:

screen width()-sprite width(img)

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 6th Aug 2010 22:33
Not exactly, the part of the sprite that is out of the area should not be drawn, but the part of the sprite in the area should still be drawn... More like one of the layers on gimp.

TheComet

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 6th Aug 2010 22:40
I think you'd have to load it into a memblock and edit it :/

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 6th Aug 2010 23:15 Edited at: 6th Aug 2010 23:29
You could always create a border sprite so all other sprites are under it. It won't cut up the sprite but it just won't be seen because the border sprite is on top.

In the following code snip I use image number 1000 for the border to guarantee the sprite it uses will be on top of any sprites that use image numbers 1 to 999.



Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 7th Aug 2010 00:53 Edited at: 7th Aug 2010 00:53
The best way would be to alter the sprite texture coords/size. Here's an example sort of ported from my macro gui:



A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 7th Aug 2010 04:58
IanM's matrix1 utilities has a command

SET SPRITE VIEW

that let's you define a window where sprites appear. That might work for you.

Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 7th Aug 2010 05:33 Edited at: 7th Aug 2010 05:34
I found like Sasuke said use Set Sprite Texture Coord
The vertex mode is 0-3 and goes like this


Then the next two values are the U and V positions in percentages of the sprite image from 0.0 to 1.0.
So vertex 0 is (0,0).
Vertex 1 (1,0).
Vertex 2 (0,1)
Vertex 3 (1,1)

Then after you change those around, to your liking,
use stretch sprite for the percentage of your vertex positions.
Example:

Here I cut off all of the sprite except for 0.08 (8%) of the top.
Then I stretched that sprite 8% in the Y direction so no streching will occur.

My computer can render anything no matter the complexity of it in real time.
The memory is enormous. My computer is unique to everyone else’s. What computer do I have?

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Aug 2010 21:40
Thanks guys, works great!

TheComet

Login to post a reply

Server time is: 2026-07-25 12:04:24
Your offset time is: 2026-07-25 12:04:24