Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1075929 Posts in 44152 Topics- by 36119 Members - Latest Member: Royalhandstudios

December 29, 2014, 04:03:16 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)How To Draw "Damage Amount" At Enemy Damage Point?
Pages: 1 [2]
Print
Author Topic: How To Draw "Damage Amount" At Enemy Damage Point?  (Read 1319 times)
ஒழுக்கின்மை
Level 10
*****


Also known as रिंकू.

RinkuHero
View Profile WWW Email
« Reply #20 on: October 07, 2013, 07:25:54 PM »

set a variable equal to the string value of damage, and then use that in the draw function, rather than using string every step. how you specifically code it and what you name the variables is up to you, and doesn't really matter; all that matters is that you don't use string() every step, just during creation

using damage directly in your example code will not work, because damage was never assigned a value in that object. you can't use a variable in one object and expect it to refer to a variable in another object of the same name. you can call it either damage or str_damage, it doesn't matter (str_ is just a marking at the start of a variable that's used to indicate that it's a string, it's part of the name and doesn't do anything). what matters is to be consistent -- use either str_damage or damage, but don't set one and then try to use the other
Logged

Jarkko Vallius
Level 0
**



View Profile WWW
« Reply #21 on: October 09, 2013, 10:56:53 AM »

I use the brackets to make it easier for me to read the code. I have yet to obtain a coder's eyes, I'm still a beginner >.>

You are doing it right. The brackets and additional lines are cheap vs. hunting down bugs caused by not using them. So, always use brackets, no matter what.
Logged

Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic