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.

Newcomers DBPro Corner / Sprite Syntax

Author
Message
stankarp
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: Australia
Posted: 23rd Oct 2003 13:51
Could I get some help please.

I was using this code which does not generate an error but after testing, concluded that the sprite x, sprite y and sprite angle functions were not returning values, only 0.


for ss=1 to 14
if sprite exist(ss)=1
ssx=sprite x(ss)
ssy=sprite Y(ss)
ssa=sprite angle(ss)
inc ssx,24
rotate sprite ss,0
paste sprite ss,ssx,ssy
rotate sprite ss,ssa
endif
next ss

I used a print function and wait key during execution and it always showed values of 0 for ssx(sprite x),ssy (sprite y) and ssa(sprite angle). Paste sprite never worked, it always pasted to the old position and did not rotate.

Can someone se an error in the syntax or se a reason why it wont return the values and paste the sprite to a new location or have I stumbled onto a bug?
zao420
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 23rd Oct 2003 16:23
there you go that should fix it
i haven't tested it but should work



stankarp
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: Australia
Posted: 23rd Oct 2003 17:25
Thanks, I'll give it a try.
stankarp
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: Australia
Posted: 24th Oct 2003 02:00
No go sorry.

I did not test last night as I was going to bed but suspected that it might not work.

ssx=sprite x ss
ssy=sprite Y ss
ssa=sprite angle ss

These return errors because there has to be ( ) around (ss).
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 24th Oct 2003 02:54
Funny, it seems that paste sprite does not update the X Y values of the sprite. Sprite X and sprite Y do return the correct values when the move sprite command is used.
--
TAZ

stankarp
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: Australia
Posted: 24th Oct 2003 08:19
Thanks Zircher.

I gave up on using paste sprite, found if I rotate the sprites to 0, then move opposite to my scrolling 2d map, they remained in place.

However, I need to reposition them at their previous angle and this is where it still does not work. sprite angle(ss) still returns zero.

for ss=1 to 61
if sprite exist(ss)=1
ssa=sprite angle (ss)
rotate sprite ss,0
move sprite ss,24
rotate sprite ss,ssa
endif
next ss

tried
ssa#=sprite angle (ss)
rotate sprite ss,ssa#

Made no difference.

Bit confused about this one
stankarp
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: Australia
Posted: 24th Oct 2003 08:25
By way of clarification, I have a large strategic map on a sprite background (2x2 the screen). The above is part of key commands to scroll round the map while leaving units (sprites) in place relative to the background.

Everything works except sprite angle now.
stankarp
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: Australia
Posted: 26th Oct 2003 02:20
Mystery partly solved. Help manual should be more specific. Reply from Gamecreators.

"> Does that mean sprite x,xprite y and sprite angle commands don't work?

Not at all - sprite positions are *not* updated by the PASTE SPRITE command,
and never have been, even in DBC. They are updated by the SPRITE and MOVE
SPRITE commands, and MOVE SPRITE has the bonus of moving the sprite at the
rotated angle - which you might find quite useful "
stankarp
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: Australia
Posted: 26th Oct 2003 02:24
PS I also had tried it with move sprite command and it also did not work?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Oct 2003 02:44 Edited at: 26th Oct 2003 13:07
Works for me. I get all the right values reported with MOVE SPRITE

I have found a bug with sprites from all this though ... when you paste a sprite it should leave the original sprite intact and draw it as normal - the bug is that it doesn't draw the sprite in its original position at all after it has been pasted.

***Edited for clarification***
Codger
22
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 26th Oct 2003 04:45
PASTE SPRITE & PASTE IMAGE do draw to screen but they only last for 1 sync if you want the "Object" to remain use SPRITE command.

System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Oct 2003 13:06
You've misunderstood what I've written ... take the code in the source button from my previous post, and add 'PASTE SPRITE 1, 400,400' just prior to the SYNC command, and you'll see what I'm getting at.

Login to post a reply

Server time is: 2024-11-25 14:28:25
Your offset time is: 2024-11-25 14:28:25