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 / Sprite help...

Author
Message
aarrowh
16
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 10th Mar 2009 17:44
I'm trying to re-create a simple game that I love playing. The Hardest Game Ever...I'm trying to just right now get a sprite up on the screen, but the sprite will not load. I get no errors no nothing, it just won't do anything. I'm using the DBP online IDE because Synergy wouldn't compile in the project folder so it wouldn't recognize my media file. Could it be the IDE?? any help appreciated,
Aarrowh

Code






Image thanks goes to AndrewT
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 10th Mar 2009 18:11
You don't need the $ in front of your variable names. In fact, I wonder if it will even compile properly if your variable name begins with a non-alphanumeric character.
Try just changing it to a = sprite exist(1).
Other than that, I can't spot any immediate error with your code.
You could always try to put sleep 100 before the sync in your function, in case the image wouldn't have got enough time to set up properly before rendering the scene. Also, you should synchronise every main loop later on, but that shouldn't be required to show that sprite.

aarrowh
16
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 10th Mar 2009 18:55
Thanks...it worked. But now I have a new problem. I planned on using the "Rotate Sprite" command to turn the sprite, but it will only turn the the set degree. I thought that it would turn that many degrees when held. I'm stumped on finding a way to turn it.



Image thanks goes to AndrewT
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 11th Mar 2009 04:03
ROTATE SPRITE SpriteNo, SPRITE ANGLE(SpriteNo)+RotationAmount



aarrowh
16
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 11th Mar 2009 05:04
Thanks a ton Bmac worked like a charm. I tried something along that line, but it wasn't as smooth...forgot what it was...



Image thanks goes to AndrewT
aarrowh
16
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 13th Mar 2009 03:13
Alright, you all have been a great help so far, so I have another question...

I need to make a type of map editor for this, I have never made one before so I have an idea but I'm not exactly sure if it would work. it would simply be 5/6 of the screen would be were you would drag everything and place it, whilst the other 1/6 would be where you would select segments or pickups and drag them onto the map section.

Now I don't know exactly how to code this, but I have an idea...(note, it is a 2d game.)

Pseudo code



Also I have no idea how I might save the maps that the editor would create....

thanks in advance!



Image thanks goes to AndrewT
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 13th Mar 2009 04:56
That process looks like it would work, it's pretty vague though.

Saving and loading maps: You can use the FILE COMMANDS:

OPEN TO WRITE
WRITE FILE
OPEN TO READ
READ FILE
CLOSE FILE

To save each segment's type and locations. For example, if all you needed to save was a segment's location and an ID telling what type it is, you could use something like this: (untested example)





Login to post a reply

Server time is: 2024-09-28 04:19:09
Your offset time is: 2024-09-28 04:19:09