On-line: гостей 0. Всего: 0 [подробнее..]
АвторСообщение
администратор




Сообщение: 71
Зарегистрирован: 19.05.07
Рейтинг: 0
ссылка на сообщение  Отправлено: 28.05.07 11:49. Заголовок: Некоторые примеры для Dark Basic


Эффект замедления - Max Payn

Remstart

Данный пример показывает как добавить небольшой эффект, как в Max Payn - замеделение времени в Ваши программы.l

Remend

` Установки дисплея
set display mode 1024,768,16
sync on : hide mouse
sync rate 50
cls :
` Создаем объекты и задаем начальные параметы, m# должно быть равным 1 для назначения 1
make object cube 1,10
m#=1

` Это пример работы
text$ = "Bullet Time... Just like Max Payne..."
set text size 36
set text font "Comic Sans MS"

` Main Loop
do

x#=OBJECT ANGLE x(1)
y#=OBJECT ANGLE y(1)

` *m# добавляется после каждых значений объектов

x#=x#+1*m#
y#=y#+1*m#
x# = wrapvalue(x#)
y# = wrapvalue(y#)

ROTATE OBJECT 1,x#,y#,0

'Если нажат пробел активируется функция

if spacekey()=1
m#=0.2
Center Text 512,675,text$
else
m#=1
endif
sync
loop


Спасибо: 0 
ПрофильЦитата Ответить
Ответов - 3 [только новые]


администратор




Сообщение: 72
Зарегистрирован: 19.05.07
Рейтинг: 0
ссылка на сообщение  Отправлено: 28.05.07 11:50. Заголовок: Re:


multiplayer client demo
sync on
sync rate 0
set window on
perform checklist for net connections
sleep 1000
o = checklist quantity()
for i=0 to o-1
print checklist string$(o)
sleep 1000
next i
sleep 1000
input "What type of net connection do you want? ",nc
set net connection nc
sleep 1000
perform checklist for net sessions
q = checklist quantity()
for w=0 to q-1
print checklist string$(q)
sleep 1000
next w
input "Join what session number? ",jgn
input "Playername? ",pn$
join net game jgn,pn$
cls
do
npc = 1
if inkey$() = "p"
cls
endif
if inkey$() = "q"
set cursor 5,420
input "Command: ",cmd$
if cmd$ = "send string"
input "text to send: ",tts$
send net message string nvc,tts$
endif
if cmd$ = "send integer"
input "value to send: ",tvs
send net message integer nvc,tvs
endif
if cmd$ = "send float"
input "value to send: (using .) ",fts#
send net message float npc,fts#
endif
if cmd$ = "get message"
get net message
if net message exists() = 1
if net message type() = 3
print "STRING: ";
print net message string$()
endif
if net message type() = 2
print "FLOAT: ";
print net message float()
endif
if net message type() = 1
print "INTEGER: ";
print net message integer()
endif
endif
endif
endif
get net message
if net message exists() = 1

` message types
` 1 = integer
` 2 = float
` 3 = string
` 4 = memblock
if net message type() = 3
print "STRING: ";
print net message string$()
endif
if net message type() = 2
print "FLOAT: ";
print net message float()
endif
if net message type() = 1
print "INTEGER: ";
print net message integer()
endif
` i'll add memblocks soon :)
endif
sync
loop

Спасибо: 0 
ПрофильЦитата Ответить
администратор




Сообщение: 73
Зарегистрирован: 19.05.07
Рейтинг: 0
ссылка на сообщение  Отправлено: 28.05.07 11:50. Заголовок: Re:


multiplayer server demo
sync rate 0
set window on
perform checklist for net connections
sleep 1000
o = checklist quantity()
for i=0 to o-1
print checklist string$(o)
sleep 1000
next i
sleep 1000
input "What type of net connection do you want? ",nc
set net connection nc
sleep 1000
perform checklist for net sessions
q = checklist quantity()
for w=0 to q-1
print checklist string$(q)
sleep 1000
next w
if q=0
input "Create net game y/n? ",yn$
input "Gamename? ",gn$
input "Player name? ",pn$
input "Max number of players? (max 255) ",np
sleep 1000
create net game gn$,pn$,np
if net game exists()=1
print "Net game sucessfully created!"
sleep 1000
cls
endif
endif
do
npc = 2
if inkey$() = "p"
cls
endif
if inkey$() = "q"
set cursor 5,420
input "Command: ",cmd$
if cmd$ = "send string"
input "text to send: ",tts$
send net message string nvc,tts$
endif
if cmd$ = "send integer"
input "value to send: ",tvs
send net message integer nvc,tvs
endif
if cmd$ = "send float"
input "value to send: (using .) ",fts#
send net message float npc,fts#
endif
if cmd$ = "get message"
get net message
if net message exists() = 1
if net message type() = 3
print "STRING: ";
print net message string$()
endif
if net message type() = 2
print "FLOAT: ";
print net message float()
endif
if net message type() = 1
print "INTEGER: ";
print net message integer()
endif
endif
endif
endif

get net message

if net message exists() = 1
` message types
` 1 = integer
` 2 = float
` 3 = string
` 4 = memblock
if net message type() = 3
print "STRING: ";
print net message string$()
endif
if net message type() = 2
print "FLOAT: ";
print net message float()
endif
if net message type() = 1
print "INTEGER: ";
print net message integer()
endif
` i'll add memblocks soon :)
endif
sync
loop

Спасибо: 0 
ПрофильЦитата Ответить
администратор




Сообщение: 74
Зарегистрирован: 19.05.07
Рейтинг: 0
ссылка на сообщение  Отправлено: 28.05.07 11:51. Заголовок: Re:


Ввод текста в DarkBasic
SYNC ON
SYNC RATE 0
TRUE=1
FALSE=0

REM The following constants are to recognise the special keys.
REM (These are the scancode values for these keys)
backspace=14
tab=15
enter=28
left=203
right=205
del=211

chopping=FALSE
REM The chopping variable signifies whether an entry is truncated
REM at the cursor when ENTER is hit. If set to TRUE, characters after
REM the cursor are chopped off the entry. If FALSE, characters after
REM the cursor are included in the entry.


WaitRepeat=500 : REM repeating begins after key is held for 500 ms
RepeatSpeed=50 : REM repeating proceeds at 1 character per 50 ms


cursor$="[]"
REM You can use any character for the cursor. Decent ones are
REM The pipe: | The slash: / The backslash: \ or underscore: _
REM you can also use multiple characters, i.e. cursor$="[]"

entry$=""
postcursor$=""
RepeatSpeed=WaitRepeat-RepeatSpeed
finished=FALSE

REPEAT
key=scancode()
REM This the next big IF block checks if a special key is being pressed.
REM If it is, it runs the code for that key. If it's not, we grab INKEY$()

IF key=backspace OR key=left OR key=right OR key=del OR key=tab OR key=enter

IF key=backspace
IF SpecialKeyRepeat=FALSE
SpecialKeyRepeat=TRUE
RepeatTime=TIMER()
IF LEN(entry$) > 0 THEN entry$=LEFT$(entry$,LEN(entry$)-1)
REM The line above does all the work for the backspace key. Everything
REM else is just to test if the repeat code should run because of
REM a held key.
ELSE
IF (TIMER()-RepeatTime) > WaitRepeat
RepeatTime=TIMER()-RepeatSpeed
IF LEN(entry$) > 0 THEN entry$=LEFT$(entry$,LEN(entry$)-1)
ENDIF
ENDIF
ENDIF

IF key=left
IF SpecialKeyRepeat=FALSE
SpecialKeyRepeat=TRUE
RepeatTime=TIMER()
IF LEN(entry$) > 0
postcursor$=RIGHT$(entry$,1)+postcursor$
entry$=LEFT$(entry$,LEN(entry$)-1)
REM The two lines above are the code for the left key. First we
REM add the rightmost character of entry$ to postcursor$, and then
REM we subtract that character from entry$ by truncating it by
REM one character. "postcursor$" is simply the part of the entry
REM which comes after the current cursor position.
ENDIF
ELSE
IF (TIMER()-RepeatTime)>WaitRepeat
RepeatTime=TIMER()-RepeatSpeed
IF LEN(entry$) > 0
postcursor$=RIGHT$(entry$,1)+postcursor$
entry$=LEFT$(entry$,LEN(entry$)-1)
ENDIF
ENDIF
ENDIF
ENDIF

IF key=right
IF SpecialKeyRepeat=FALSE
SpecialKeyRepeat=TRUE
RepeatTime=TIMER()
IF LEN(postcursor$) > 0
entry$=entry$+LEFT$(postcursor$,1)
postcursor$=RIGHT$(postcursor$,LEN(postcursor$)-1)
ENDIF
ELSE
IF (TIMER()-RepeatTime)>WaitRepeat
RepeatTime=TIMER()-RepeatSpeed
IF LEN(postcursor$) > 0
entry$=entry$+LEFT$(postcursor$,1)
postcursor$=RIGHT$(postcursor$,LEN(postcursor$)-1)
ENDIF
ENDIF
ENDIF
ENDIF

IF key=del
IF SpecialKeyRepeat=FALSE
SpecialKeyRepeat=TRUE
RepeatTime=TIMER()
IF LEN(postcursor$) > 0
postcursor$=RIGHT$(postcursor$,LEN(postcursor$)-1)
REM The delete key is similar to the backspace key, except that
REM it removes characters AFTER the cursor instead of before it.
ENDIF
ELSE
IF (TIMER()-RepeatTime)>WaitRepeat
RepeatTime=TIMER()-RepeatSpeed
IF LEN(postcursor$) > 0
postcursor$=RIGHT$(postcursor$,LEN(postcursor$)-1)
ENDIF
ENDIF
ENDIF
ENDIF

IF key=enter
IF chopping=TRUE
FinishedEntry$=entry$
ELSE
FinishedEntry$=entry$+postcursor$
ENDIF
finished=TRUE
ENDIF

ELSE
REM This ELSE means "if a special key is not being pressed".
REM Now it's time to get the current character-key being pressed
REM and add it to entry$.
REM Also, since we now know that no special key is being held,
REM we can set SpecialKeyRepeat to FALSE.

SpecialKeyRepeat=FALSE
currentkey$=inkey$()
IF currentkey$=""
repeater$=""
ELSE
IF currentkey$ <> repeater$
entry$=entry$+currentkey$
repeater$=currentkey$
ENDIF
ENDIF
ENDIF


REM Now we display the current entry.
CLS
TEXT 0,0,entry$+cursor$+postcursor$
SYNC

UNTIL finished=TRUE

TEXT 0,100,"you entered:"
TEXT 0,120,FinishedEntry$
END

Спасибо: 0 
ПрофильЦитата Ответить
Ответ:
1 2 3 4 5 6 7 8 9
большой шрифт малый шрифт надстрочный подстрочный заголовок большой заголовок видео с youtube.com картинка из интернета картинка с компьютера ссылка файл с компьютера русская клавиатура транслитератор  цитата  кавычки моноширинный шрифт моноширинный шрифт горизонтальная линия отступ точка LI бегущая строка оффтопик свернутый текст

показывать это сообщение только модераторам
не делать ссылки активными
Имя, пароль:      зарегистрироваться    
Тему читают:
- участник сейчас на форуме
- участник вне форума
Все даты в формате GMT  3 час. Хитов сегодня: 0
Права: смайлы да, картинки да, шрифты да, опрос нет
аватары да, автозамена ссылок вкл, премодерация откл, правка нет



WireNet (Phoenomix)

WireNet (Phoenomix)
Клуб профессиональной дрессировки собак Tools of Death - Энциклопедия орудий смерти! Сайт затрагивает тему смерти, и все что с ней связано. Рассматривается все то, что нас убивает. Создай свою игру или скачай готовую Создание сайтов, анимаций, потретов. Уникальные рисованные сайты Мужской форум SmehOff Фан-форум Уилла Смита Обмен кнопочками находится здесь! Заходите и станьте нашим другом!
Первый электротехнический поиск TOPlist минск, поиск информации