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.

DarkBASIC Professional Discussion / More simple way for this code?

Author
Message
gamecoader5000
6
Years of Service
User Offline
Joined: 22nd Apr 2018
Location:
Posted: 28th Apr 2018 14:04
I am trying to figure out a easer way, trying to lesson my code load,

So I have a system to when you are at a certin range you then paste a image at that new location.

So I'm Shure there is a easy way to put this in a array or to simplify it.

Any help is appreciated.


MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 30th Apr 2018 08:45
Hi,
Maybe this can help?
not tested code!

Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th Apr 2018 14:36
First off, I would make the SCREEN WIDTH() and SCREEN HEIGHT() CONSTANT variables at the start of your program. You could also store the width and height of image 1 in variables too. I do not follow the logic of your code. If, for example, player.health is > 90, then you are going to paste 11 different sprites and it will be greater than 0, greater than 10, etc. Same with player faith and power.

So, I quickly put together what I think will work, but I have not tested it. Here you go:




So many games to code.....so little time.

Login to post a reply

Server time is: 2024-04-26 12:55:02
Your offset time is: 2024-04-26 12:55:02