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 / Moving a letter or a oblect around the screen

Author
Message
Ian Hughes
20
Years of Service
User Offline
Joined: 29th Sep 2003
Location: UK
Posted: 30th Sep 2003 16:19
Hi
I am new to dark baisc and programing what i am trying to do is use keys ie "z and x to move left and right and p and l to move up and down" to move a letter or and graphic around the screen and i am not having much luck can some guid me. Also can anyone let me know if Game Programming with DarkBasic (International Edition): Book and CD is worth buying?

Hope some one can help
Ian

Spam UK
Kentaree
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 30th Sep 2003 17:16


You could also use keystate() to get the keys pressed.

I would be unstoppable if I could just get started...
Ian Hughes
20
Years of Service
User Offline
Joined: 29th Sep 2003
Location: UK
Posted: 30th Sep 2003 17:24
can you let me know if Game Programming with DarkBasic (International Edition): Book and CD is worth buying?

Spam UK
Kentaree
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 30th Sep 2003 17:25
I'm not sure, I've heard some positive remarks about it, but I havent got it myself, so I cant really say.

I would be unstoppable if I could just get started...
Ian Hughes
20
Years of Service
User Offline
Joined: 29th Sep 2003
Location: UK
Posted: 30th Sep 2003 17:55
Hi
thanks for your help......is it possibale to press to keys at once so they go diagonal also i have notice a program in the demos explaning key values ie if i press x and l it will give me a number for a inkey and a ascii values and mosue x,y and scancode and mouse click is this the imformation i need to use if i want to move my letter a around the screen in all directions

Ian

Spam UK
Kentaree
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 30th Sep 2003 18:03
Yes, you would use scancode to get the values, then use keystate(value) using the value from scancode. This will also solve your diagonal problem as keystate can handle more than one keypress at the same time.

I would be unstoppable if I could just get started...
Ian Hughes
20
Years of Service
User Offline
Joined: 29th Sep 2003
Location: UK
Posted: 30th Sep 2003 18:55
Hello again
ok i have been playing around with this code changing the letter e and chaging the speed e.t.c.but what i need to is use my .bmp graphic to move around the screen do i need to use a command like

load bitmap "pics\bitmap0.bmp" and replace this letter$="a"



so i can move the chr around the screen instead of the letter a
so the code would be like

load bitmap "pics\bitmap0.bmp"
letterX=0
letterY=0

do
cls

if inkey$()="z" and letterX>0 then letterX=letterX-1
if inkey$()="x" and letterX<640 then letterX=letterX+1
if inkey$()="p" and letterY>0 then letterY=letterY-1
if inkey$()="l" and letterY<4000 then letterY=letterY+1
text letterX, letterY, letter$
loop


this code does not work as i getan error
hpe you can help

Spam UK
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 30th Sep 2003 18:59
isn't there a position bitmap command?

-RUST-
B0SS
21
Years of Service
User Offline
Joined: 7th Jul 2003
Location: Malta
Posted: 30th Sep 2003 19:01
About books i found Beginner's Guide to Darkbasic game programming very interesting although i have good programming skills
Kentaree
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 30th Sep 2003 19:24
You forgot to assign the bitmap a number, in this case probably 1.
Also, the commands used to put text on the screen does not work for bitmaps. For bitmaps, you'd use paste bitmap.



I would be unstoppable if I could just get started...
Ian Hughes
20
Years of Service
User Offline
Joined: 29th Sep 2003
Location: UK
Posted: 30th Sep 2003 20:00
hello
I have pasted this code into dark basicanditcomeback with an error

sintex errpr unknown comamand paste bitmap 1, letterX, letterY

?
any iedas

Spam UK
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 30th Sep 2003 21:14
paste bitmap isn't a command in db, you have to change it to this


hope that helps


Andrew
21
Years of Service
User Offline
Joined: 23rd Aug 2003
Location: United Kindom (what makes it important?)
Posted: 30th Sep 2003 21:17
The code you have pasted has to be edited, you cant just have a code copied and replaced in your DBP.
OK i understand you are new, ok so try looking at some tutorials, like i know a tutroial with something like this on it.

It may help.

The book is actually worth buying, but i recoommend you learn without it, because you learn more.
Hope this helps and good luck!!!

My game will make sure Final Fantasy will never be forgotten.
Remember me because my game will be in the shops in a year or 2.
Ian Hughes
20
Years of Service
User Offline
Joined: 29th Sep 2003
Location: UK
Posted: 30th Sep 2003 22:13
Hi
Thanks you all for your support I wil keep pluging away I hope you will give more support if i need it
Cheers
Ian

Spam UK

Login to post a reply

Server time is: 2024-09-21 01:05:44
Your offset time is: 2024-09-21 01:05:44