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.

2D All the way! / stupid question

Author
Message
Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 22nd Mar 2004 15:54
im very rusty on my basic.

All i wanted to do it to display the xy of the mouse see code.

it does it but over writes the existing. if i put a cls in there its too fast to see anything. what am i doing wrong

thanks

Morloc

Morloc
Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 22nd Mar 2004 16:02
ok ive got the cls to work but i dont really want it to flicker just update the variables see code

Morloc
AJay
21
Years of Service
User Offline
Joined: 24th Jan 2004
Location:
Posted: 22nd Mar 2004 16:44
I had this problem before. What i did instead of clearing the screen was i put the text in a box. When i wanted the text to change i would just put another box ontop of that box, then print the new text in it. I hope that makes sense.






P4 3.2GHZ, 256MB DDR Ram, 64MB NVidea G-Force 4, Sound Blaster Live, 40 Gig HD Thanks to Coding Area

Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 22nd Mar 2004 17:02 Edited at: 22nd Mar 2004 17:04
Instead of using print use text. Then put set text opaque at the beginning of your code. Then use Text x,y,"Spaces" to delete what was there before.

Edit: had to use the word spaces because Apollo doesn't allow them.

Pincho.

Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 22nd Mar 2004 18:56
thanks guys i did start to look at these options but run out of time in my work lunch

If i was to take this to next next step and add a bitmap background I presume these wouldnt work? as the blocking would block sum of the background out. I could take the easy option and have say "a score variable" in a blocked out black area to begin with. Or build up say a score with sprites.

Still the text function seems a better way for what i need atm as its only for error checking.

thanks again guys

Morloc

Morloc
Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 23rd Mar 2004 14:09
Ok this one isnt quite as stupid. Im trying to get my head around having multiple animated sprites. ie 2 enemies popping up firing etc (posibly different speeds but also say animated sprites just in the background for eye candy too).

For the enemies i was going code each one individually, checking if they were hit or had fired. then in a loop a random number would pick which enemy type and where it would be. the problem i cant quite get my head around is if i want 2 enemies at the same time, as surley i can only be in one enemie routine (loop) at a time and while its in this code section it wont be able to continue the code for the rest of moving sprites..

god i hope that made sense.

can anyone shed sum light on this

thanks

Morly

Morloc
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 23rd Mar 2004 14:34
Your program should just have 1 main loop.

Do

Sync
Loop


In here you can put as many enemies as you want, but they can't be in their own loop. You don't see them until your program gets to the Sync command. The Sync command shows all of them at the same time.

Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 23rd Mar 2004 15:49
Yeah, I use the for/next command to place all my enemies, a bit likt this pseudo code:


dim frame(1000)


do
sync

for n=firstenemyspritenumber to enemycount
if sprite exist(n)=1
frame(n)=frame(n)+1
sprite n,blah,blah,frame(n)
endif
next n

loop


you can then tell it to check the frame(n) for what image it wants to be displaying. This will get all the enemies set up ready for the sync to draw them.Also, I find it easier if I put the sync at the top of my loop, but thats just a personal preference... I put the check in to see if the sprite exists because this will cause your program to crash if it tries to plot a sprite that doesnt exist...

GIve me more power!

Login to post a reply

Server time is: 2025-06-30 15:34:07
Your offset time is: 2025-06-30 15:34:07