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.

Code Snippets / Text change in DBP

Author
Message
vivi
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 16th Jul 2003 00:38
Hi,

I got this code off of another post from dark forge using the forum search found in general chat. SO my guess is that the post is long dead.
Here is my problem. I need to create a text change when the mouse goes over the text. Like this one:

` -------------------------------------------------------------------------
` Roll-over Text Change DarkForge FAQ 21/12/2000
` -------------------------------------------------------------------------
` Coded for a forum request in 10 mins one evening to show how to do a
` text roll-over without any sprite collision or complicated arrays.

sync rate 0
sync on
hide mouse

` Create a basic new mouse pointer (image 1)

ink rgb(0,255,0),0
line 8,0,8,16
line 0,8,16,8
get image 1,0,0,17,17

` Create a basic new roll-over mouse pointer (image 2)

cls 0
line 0,0,16,16
line 0,16,16,0
get image 2,0,0,16,16

` Set-up the font properties

set text font "Arial"
set text size 18

data$="This is our sample line of text!"

tx=200
ty=150
tw=text width(data$)
th=text height(data$)
rollover=1

do

cls rgb(0,0,50)

sprite 1,mousex(),mousey(),rollover

if mousex()>=tx and mousex()=ty and mousey()=xpos and mousex()=ypos and mousey()

Login to post a reply

Server time is: 2024-04-16 08:00:03
Your offset time is: 2024-04-16 08:00:03