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 / How to add a pic

Author
Message
lacorp
17
Years of Service
User Offline
Joined: 7th Nov 2006
Location:
Posted: 8th Nov 2006 00:16
Hi, I am new to the forum and have a programming question.
I am making a text-based game and was wondering if it was possible to make a picture appear. Also how can I make it so the picture will disappear after 10 seconds

To err is human, to balme other people for your mistakes is management potential.
lacorp
17
Years of Service
User Offline
Joined: 7th Nov 2006
Location:
Posted: 8th Nov 2006 00:20
I almost forgot, the language I am using is DBP

To err is human, to balme other people for your mistakes is management potential.
Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 8th Nov 2006 01:30
First you'll need to load the picture via the "LOAD IMAGE filename,image number" command. Next, you'll need to put the image on the screen using a sprite or the PASTE IMAGE command.

Example Code:



That's a little model for ya.

Tutorials:
Array
Functions
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 8th Nov 2006 01:41 Edited at: 8th Nov 2006 01:43
You can paste the image to the screen with "paste image", use "timer()" to determine if 10 seconds have past and there are several ways to make the image disappear.

One method is to simply clear the screen with "cls". In this code it clears the screen and pastes the image every loop... once "sec" is zero it exits the loop and make another "cls" without pasting the image.



Or if you don't like the idea of clearing the screen (which would clear all typed text you can change the ink color to black and make a box over the picture.



You can also make the image a sprite and have it slowly fade out (since you use Pro). I'll post that code in a few hours... I've got to get back to work right now.

Attachments

Login to view attachments
warship45
19
Years of Service
User Offline
Joined: 24th Jul 2004
Location: uk
Posted: 8th Nov 2006 08:25 Edited at: 8th Nov 2006 08:27
or you could just do it like this which would be much simpler. it is not the best way to do it but for new people it is most likly easyer to understand



dbpro plugins
www.0z0.co.uk
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 8th Nov 2006 12:27
Ack... the human world distracted me from getting here till now.

I think I sometimes get too eager to help... I need to slow down for newbies.

Here's the code using a sprite and fading it out (if you don't get it right away don't get discouraged):

Login to post a reply

Server time is: 2024-04-25 10:37:59
Your offset time is: 2024-04-25 10:37:59