Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 14,141 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Sprite Animation #443304
07/12/14 22:04
07/12/14 22:04
Joined: Aug 2013
Posts: 39
A
Adulescens Offline OP
Newbie
Adulescens  Offline OP
Newbie
A

Joined: Aug 2013
Posts: 39
Hallo,
ich habe das Handbuch gründlich durchgelesen und habe nirgends gelesen, wie man eine 2D Animation vor oder auf einen Panel schiebt. Immer wenn ich eine Sprite (also 2D) Animation im Skript starte, erscheint zwar die Animation, aber sobald ich ein Panel hinzufüge, ist die Animation immer hinter dem Panel und ich las im Handbuch nirgends, wie man die Animation vor das Panel bekommt. Gibt es hierfür eine Art Layer-Funktion für die Sprite Animation? Oder kann man sie irgendwie an ein Panel anheften?

Danke laugh
Lg

Re: Sprite Animation [Re: Adulescens] #443306
07/13/14 07:11
07/13/14 07:11
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Im not sure I understand what you are trying to achieve..

Are you trying to animate a sprite, that is behind a panel?

Panels are generally fixed to the camera, where sprites are placed inside the virtual realm of awesome.

Thus, this creates it so that your sprite will be behind the panel.
What you need to achieve is either a loop which controls the panel you are trying to animate, and each frame (or however often it changes) have it change to the next animation, looping itself.

Code:
function animate_panel(){
if(panel_number == 0) reset(panel4, SHOW);set(panel1,SHOW);return;
if(panel_number == 1) reset(panel1, SHOW);set(panel2,SHOW);return;
if(panel_number == 2) reset(panel2, SHOW);set(panel3,SHOW);return;
if(panel_number == 3) reset(panel3, SHOW);set(panel4,SHOW);return;
}



Im sure there is a better way to do this, but this is an idea for you to try laugh

I Really hope this is the answer you were looking for wink


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Sprite Animation [Re: DLively] #443310
07/13/14 09:21
07/13/14 09:21
Joined: Aug 2013
Posts: 39
A
Adulescens Offline OP
Newbie
Adulescens  Offline OP
Newbie
A

Joined: Aug 2013
Posts: 39
Yea I want to set a sprite animation in front of a Panel,
but what you said is another good way to show an animation laugh
Thank you for the code! I'll try it laugh

Last edited by Adulescens; 07/13/14 09:24.
Re: Sprite Animation [Re: Adulescens] #443311
07/13/14 09:26
07/13/14 09:26
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Instead of defining multiple panels and using if statements for each of them you can just use a BMAP array and then iterate over those instead:

frame = floor(total_ticks*0.5);
frame %= 8;
my_panel.bmap = bmp_animation[frame];

The (bmp_animation) BMAP* array needs to be filled at game start.


"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: Sprite Animation [Re: Superku] #443314
07/13/14 12:02
07/13/14 12:02
Joined: Aug 2013
Posts: 39
A
Adulescens Offline OP
Newbie
Adulescens  Offline OP
Newbie
A

Joined: Aug 2013
Posts: 39
Yea it's a good idea grin But what means "floor" in this context? The Skript Editor don't know "floor"

Re: Sprite Animation [Re: Adulescens] #443316
07/13/14 12:17
07/13/14 12:17
Joined: Nov 2011
Posts: 274
de
lemming Offline
Member
lemming  Offline
Member

Joined: Nov 2011
Posts: 274
de
Originally Posted By: Adulescens
Yea it's a good idea grin But what means "floor" in this context? The Skript Editor don't know "floor"


http://www.conitec.net/beta/avar-int.htm

Re: Sprite Animation [Re: lemming] #443331
07/13/14 19:26
07/13/14 19:26
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Floor is essentially saying "Round to the nearest whole number"

So instead of 5.5643334 - its 6
or 4.345678 will be 4


Someone correct me if I am wrong.


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Sprite Animation [Re: DLively] #443332
07/13/14 21:01
07/13/14 21:01
Joined: Aug 2013
Posts: 39
A
Adulescens Offline OP
Newbie
Adulescens  Offline OP
Newbie
A

Joined: Aug 2013
Posts: 39
Ahh ok
Thank you guys for your help! laugh

Re: Sprite Animation [Re: Adulescens] #443336
07/13/14 22:22
07/13/14 22:22
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
That's not exactly how floor() works, sorry DLively.
floor and ceiling are two mathematical functions, see here: http://en.wikipedia.org/wiki/Floor_and_ceiling_functions
Thus the floor() function behaves as follows: "floor(x) is the largest integer not greater than x", which means:
floor(3.41) = 3;
floor(3.99) = 3;
floor(4) = 4;
floor(-1) = -1;
floor(-1.2) = -2;
floor(-1.9) = -2;


"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: Sprite Animation [Re: Superku] #443354
07/14/14 13:49
07/14/14 13:49
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Oh.blush

Well, I stand corrected laugh
Thanks for clearing that up Superku! That makes so much more sense than the way I thought it worked grin


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com

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

Gamestudio download | 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