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 code debug

Author
Message
monstercameron
14
Years of Service
User Offline
Joined: 24th Dec 2009
Location:
Posted: 24th Dec 2009 20:13


guess what

Attachments

Login to view attachments
Veron
17
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 24th Dec 2009 20:25
How about some more information? What errors are you getting/what are you trying to achieve?

monstercameron
14
Years of Service
User Offline
Joined: 24th Dec 2009
Location:
Posted: 24th Dec 2009 21:46
ok. the sprite wont animate nor will it move on the x/y. the mirror does work though

guess what
monstercameron
14
Years of Service
User Offline
Joined: 24th Dec 2009
Location:
Posted: 24th Dec 2009 21:48
what are your thoughts on my coding skills and tips, anyone

guess what
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 25th Dec 2009 11:18
The word chaotic comes to mind.

There's no need to jump around all over the place. All that jumping around can be put in the proper order you want them ran.

I'm going to assume you load multiple copies of the same images because their just placeholders till you get all the animation frames you want. If that's not the case... theres no need to do that.

Making starup$="on" and making a WHILE/ENDWHILE loop checking for the exact moment you turn it off in mainloop is pointless because they only need to be ran once.

When anim=1 the part in the code snip below will create a never ending loop for which there is no escape since anim will always equal 1 within this loop. It's better to use an IF/ENDIF instead.


The variables herox and herox# are two different variables. herox is an integer (like 504) and herox# is a float (like 283.2344). All 2D coordinates are whole numbers so there's no need to use floats at all.

The y coordinates for the up and down arrow keys need to be switched. If you want to see the character go down the screen increase the y and if you want it to go up the screen decrease the y.

Don't be afraid of rem statements... the more you have the better you'll understand the code later.

Here's your code cleaned up a bit:


monstercameron
14
Years of Service
User Offline
Joined: 24th Dec 2009
Location:
Posted: 26th Dec 2009 03:26
wow, thanks Grog..., what a difference, skill & experience, but the sprite is endlessly animating and is movin way too fast i think its the anim=1 flag, should i place anim=0 in the else sections in the loop?

guess what
monstercameron
14
Years of Service
User Offline
Joined: 24th Dec 2009
Location:
Posted: 26th Dec 2009 07:46
ok ive, modified the code a bit here:


rigth now im looking for falling with gravity but can seem to get the acceleration correct (maybe the for next loop is being processed to fast)

help me!!!
i need help with acceleration due to gravity! (maybe with the timer?) and a easy way to scroll a level.

guess what

Login to post a reply

Server time is: 2024-09-28 12:18:35
Your offset time is: 2024-09-28 12:18:35