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.

DarkBASIC Professional Discussion / Russian Roulette game animation

Author
Message
20Glyphs
9
Years of Service
User Offline
Joined: 7th Mar 2015
Location:
Posted: 1st Nov 2015 23:24
Hey, guys.

Some of you might remember but I was here a couple of weeks ago and I was asking about a problem with my code for a Russian roulette game and people helped me a lot and I'm so grateful, but now I ran into another problem. Instead of sound, I'm now using video. Here's the code:


Now, the problem is that the video previously played stays on screen and the video that's supposed to play, plays in the background but I can't see it because the prior video is still on screen.

Any help would be appreciated.
Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 3rd Nov 2015 00:22 Edited at: 3rd Nov 2015 00:24
The way I see it with your code:



Probably the problem is no sync in your do-loop code

BUT:

DELETE ANIMATION
This command deletes an animation previously loaded into the specified Animation Number. Deleting animations when you have finished with them improves system performance. If the animation is not
stopped before the animation is deleted, the current frame of the animation remains on the screen or bitmap.

STOP ANIMATION
This command stops the specified animation if it is playing.

So it maybe the case that you need to stop and delete the animations everytime and reload them

hope it can help
20Glyphs
9
Years of Service
User Offline
Joined: 7th Mar 2015
Location:
Posted: 3rd Nov 2015 05:41
Quote: "The way I see it with your code:

+ Code Snippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
load animation "C:\Users\pc\Documents\Bandicam\bandicam 2015-11-01 17-11-21-262.avi", 3
load animation "C:\Users\pc\Documents\Bandicam\bandicam 2015-11-01 17-13-32-132.avi", 2
load animation "C:\Users\pc\Documents\Bandicam\bandicam 2015-11-01 17-26-45-644.avi", 1

play animation 3

do
gosub setanim
sync
loop

setanim:
animflag = 0
for i = 1 to 2
if animation playing (i) = 1 then animflag = 1
next i

if animflag = 0 and mouseclick() = 1
NUMB = 1 + rnd(1)
play animation NUMB
sync
randomize timer()
endif
return


Probably the problem is no sync in your do-loop code

BUT:

DELETE ANIMATION
This command deletes an animation previously loaded into the specified Animation Number. Deleting animations when you have finished with them improves system performance. If the animation is not
stopped before the animation is deleted, the current frame of the animation remains on the screen or bitmap.

STOP ANIMATION
This command stops the specified animation if it is playing.

So it maybe the case that you need to stop and delete the animations everytime and reload them

hope it can help"


Thank you so much for your reply. Adding sync doesn't change anything, unfortunately. Delete animation is the only way (Stop doesn't change anything either), but I don't know how exactly to set it up. If I tell it to delete animation if I press the mouse key, it'll work the first time, but not any other time because it had already deleted the animation. That's one problem, the other problem is how to make a statement loop where whenever an animation is not playing it wouldn't obstruct the one playing after it, you know?
Scorpyo
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 3rd Nov 2015 08:14 Edited at: 3rd Nov 2015 08:16
Something like this:



Not sure it will work , I've never used animation commands, but the logic is there, probably the command stop animation is redundant since you check when playing is over with the animflag
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 3rd Nov 2015 17:11 Edited at: 3rd Nov 2015 18:19
Deleting animations is known to leak memory. Try this.

Login to post a reply

Server time is: 2024-04-19 12:23:43
Your offset time is: 2024-04-19 12:23:43