Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,213 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How can I decrease this panel? #425480
07/06/13 09:10
07/06/13 09:10
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
So I have a health bar that I want to have decreased to the center. Its a shame that we dont have a library of simple functions like these at our disposal. Anyway, enough ranting. Here is what I am trying to do, I want to have a health bar clip its image from the outside going to the inside. I have checked into using the bmap pixel functions but they seem slow for what I need. I also considered using scale_x, however all that does is just stretch the panel without regard to the shape of the image on the bmap. I suppose its best to show in a series of pictures to show what i am looking for


Health = 100;
oooooooooooo
ooo ooo

Health = 60;
oooooooo
oo oo

Health = 30;
oooo


Health = 10;
oo

Notice how as the health gets lower, the image gets CLIPPED from the outsides towards the center of the image. It would be nice to have a simple CLIP flag for the panels which would instruct the engine to always clip anything outside of the panels size_x/size_y range. Heck even allowing manipulation of the bmaps position within the panel would be a treat.

Anyway, does anyone know of a way I could achieve this effect? Any suggestions would be most helpful. Thanks again guys.

Last edited by exile; 07/06/13 09:12.
Re: How can I decrease this panel? [Re: exile] #425483
07/06/13 09:45
07/06/13 09:45
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
you can clip and move images on panels with windows (pan_setwindow). You only have to calculate the new window position and width each time the health changes.

Salud!

Re: How can I decrease this panel? [Re: exile] #425484
07/06/13 09:50
07/06/13 09:50
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline
Expert
Error014  Offline
Expert

Joined: Jul 2002
Posts: 3,208
Germany
I'm not sure I understand correctly - I suppose you'd want to use the forum's CODE-thing for your ASCII-art up there.

Anyway, have you checked the window-parameter of a panel? It's probably the easiest way to achieve this for you, though you do need two variables for this. (or use pan_setwindow)

A better way would be using draw_quad. The x-coordinates of vOffs would then be something along the lines of (bmap_width/2*(1-HEALTH/100)) (assuming HEALTH goes from 0..100, whereas the x-coordinate of the size-parameter would be (bmap_width*HEALTH/100) [again assuming Health is 100 at max].
I'm not quite sure what happens with the y-coordinate (the height) in your example - you maybe need the same code as above but with _height.
Anyways, that should get you started.

Feel free to ask if you need more help!


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Re: How can I decrease this panel? [Re: Error014] #425490
07/06/13 12:34
07/06/13 12:34
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I assume you are already aware that you can clip the image/ its right side via panel.size_x as a workaround.

Shaders are surprisingly good for UI related things and if you want I can write one for you that does approximately what you are looking for.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: How can I decrease this panel? [Re: Superku] #425499
07/06/13 19:15
07/06/13 19:15
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
Thanks for the tips guys, draw quad was EXACTLY what I was looking for. It would be nice if there was a page in the manual that listed the functionality of the draw functions.

Thanks again!

Re: How can I decrease this panel? [Re: exile] #425518
07/07/13 09:51
07/07/13 09:51
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline
Expert
Error014  Offline
Expert

Joined: Jul 2002
Posts: 3,208
Germany
Quote:
It would be nice if there was a page in the manual that listed the functionality of the draw functions.


Yeah, that's true. I agree that sometimes, it can be difficult to find what you want - if you don't know that there's a bunch of functions with "draw_", how are you supposed to find it? So you're definitely right that more "HOW TO DO [X]"-pages in the manual that cover certain specific aspects would be nice.

May I humbly ask you to post your request in "Blame the Manual", however? I've found jcl to be rather friendly about these kind of suggestions - after all, he himself probably knows the engine too well to understand what kind of problems those who do not know it's source code face.


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Re: How can I decrease this panel? [Re: Error014] #425530
07/07/13 19:47
07/07/13 19:47
Joined: Nov 2011
Posts: 274
de
lemming Offline
Member
lemming  Offline
Member

Joined: Nov 2011
Posts: 274
de
Quote:
It would be nice if there was a page in the manual that listed the functionality of the draw functions.

Originally Posted By: Error014
if you don't know that there's a bunch of functions with "draw_", how are you supposed to find it?


Are you guys serious?



Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1