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 / dbp:simpel problem

Author
Message
raar
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location:
Posted: 4th Jan 2005 04:59
i have a small problem with this code:


As i understand my own code i load up an image substract the part i need from it and place it in image 1 and make a sprite off it and place it in sprite 1. If i press left mouse button it should turn 180 degree and if i press button two it should turn 90 degree. All good so far it works but it doesn't turn anymore if i press the button a second time.If i press left and then right and then left again it goes back to the place where it was after i pressed left for the first time while it shouldn't rotate to that position.

Any ideas on this i bet simple problem
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 4th Jan 2005 09:17
The rotate sprite command is absolute and doesn't add together. Try rotating it by it's angle + 90 and it's angle + 180 like this:



raar
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location:
Posted: 5th Jan 2005 19:39 Edited at: 5th Jan 2005 19:46
thanks that solved the problem
a few other questions though:
°when i load the plane image and then draw some mountains on the screen, how do i determine wich one is on top, its 2d so when i move the plane where the mountain is i want the mountain to be displayed, is it so that the last one drawn in the loop will be on top (seems most logical to me)

°I noticed that when i use the rotate command it takes one of the courners to rotate it, how do i get it to rotate around the middle of the image?

°whats the best way to move the sprite using the mouse: making a sprite of the image in the loop or pasting it in the loop or an other way.

°Is there a way to include the images in the exe or do you have to copy the map over when you want to run it on an other pc.

°Is there a site that has all kinds of free 2d images to use in my test games, because my gfx skills are not very high.

°when i have a image to use as the background do i have to copy it manually to make it the background on the whole screen or is there a command that fills the whole screen with that image (eg: background image is 64*64 and resolution is 800*600 and i want to fill the whole background with that image)

I had some other questions too but i can't remember em now :s, so most likely i ll update this thread a few times so that i don't start too many threads.
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 6th Jan 2005 01:18 Edited at: 6th Jan 2005 01:26
Quote: "I noticed that when i use the rotate command it takes one of the courners to rotate it, how do i get it to rotate around the middle of the image?"


Offset sprite [sprite number],[sprite width/2],[sprite height/2](i think)

Quote: "whats the best way to move the sprite using the mouse: making a sprite of the image in the loop or pasting it in the loop or an other way."


paste sprite [sprite number],mousex(),mousey()

[edit]
Quote: "is it so that the last one drawn in the loop will be on top (seems most logical to me)"


yes
[/edit]

Am I the only one here who's really confused?
http://db1games.topcities.com
(used to be demonsbreath)
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 6th Jan 2005 01:38
Quote: "is it so that the last one drawn in the loop will be on top "


No.

set sprite priority is the command you need to specify what order sprites are drawn.

Boo!
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 6th Jan 2005 04:06 Edited at: 6th Jan 2005 04:24
Oh... sorry... I was thinking images & drawing commands and all that lot, not sprites...

Am I the only one here who's really confused?
http://db1games.topcities.com
(used to be demonsbreath)
raar
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location:
Posted: 6th Jan 2005 04:33
thanks for the response, though some questions are still open
Also:
is there a command like "%" in C gives the rest after a division (best explenation i can give off it in english :p) i know there are other ways to do it but it would be nice if it exists
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 6th Jan 2005 17:02 Edited at: 6th Jan 2005 17:03
Quote: "is there a command like "%" in C gives the rest after a division (best explenation i can give off it in english :p) i know there are other ways to do it but it would be nice if it exists "


Either use mod or %%

mod won't turn blue but is a valid command.


The word "Gullible" cannot be found in any English Dictionary.
raar
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location:
Posted: 7th Jan 2005 03:08 Edited at: 7th Jan 2005 03:10
hehe new question
how do i make the collision the way that it doesn't detect collision between the transparant pixels of my sprites
i thought the sprite hit command did that but it seems it doesn't :s
also when i just paste a sprite the sprite that is made with the sprite command is still there and the collision will occur whit the one i made with the sprite command and not with the pasted one
raar
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location:
Posted: 8th Jan 2005 00:32
mms i also can't figure out how i spawn 1 enemy every three seconds i used this expression:
((timer()/1000)-starttime)%%3 =0
and then i run thru an array to see what sprite is available to spawn but it spawns all and not one

i can't seem to find a fault in my code
Neofish
20
Years of Service
User Offline
Joined: 7th Apr 2004
Location: A swimming pool of coke
Posted: 8th Jan 2005 03:01
that would mean ((timer()/1000)-starttime)%%3 =0 is always true...

...after testing, ((timer()/1000)-starttime)%%3=0 for the whole of one second, you need to make it only go through the if once per second, not for every 0

raar
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location:
Posted: 8th Jan 2005 08:01
yeah i thought it was something like it but i can't get it to do it once i thought of:
((timer())-starttime*1000)%%3000=0
but then it doesn't always do it i think because the loop can take longer than 1/1000 of a second right? So you got any sollution
Also my collision is still doing collision between transparant pixels (believe that is called bounding rectangle collision) and not impact collision, i need help on that one too.
raar
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location:
Posted: 11th Jan 2005 05:33
nother question:
is there a function to sort an array? (need this to make a high score with 10 entry's and sort it then)

Login to post a reply

Server time is: 2024-11-27 18:51:17
Your offset time is: 2024-11-27 18:51:17