scoring issue...

If you have are having trouble with DS Game Maker V4 and you don't know why, please post your question here

scoring issue...

Postby Ruffsta » Fri Mar 12, 2010 7:24 pm

trying to get the word "Health" in front of the health... so it appears like this: Health: 100

Code: Select all
Draw Health 1;77;6;Health
If Stylus.Newpress
If Sprite Touched 0
Increment Health 20;-
End If
End If



for whatever reason, i can't get a word in front of the numbers...

please help, ty
BananaCraze - COMPLETED
MasterMind - COMPLETED

My online mafia game: http://www.thecartelproject.com - players wanted!

Image Meh, i don't give a damn... Dumb ass!
User avatar
Ruffsta
 
Posts: 479
Joined: Sat Nov 28, 2009 6:08 am
Location: USA
Current Project: Potion Frenzy & not saying

Re: scoring issue...

Postby AlceX » Fri Mar 12, 2010 7:27 pm

Try using your own variable instead of Health.
"Dream a little dream."-Chevre(Animal Crossing:Wild World)

Finished Projects:Puzzle N01: To Bulban
Santa's Flight
Current WIP's: Turnip Merchant

My Deviantart Page
User avatar
AlceX
 
Posts: 770
Joined: Wed Nov 18, 2009 10:22 pm
Current Project: Turnip Merchant

Re: scoring issue...

Postby Ruffsta » Fri Mar 12, 2010 7:28 pm

uh, that IS the variable i want tho... :roll:


my game consists of: Health, Level and Points...

Health: 100
Level: 1
Points: 1,000

either way.. i can't get a word to go in front of the numbers.... :evil:
BananaCraze - COMPLETED
MasterMind - COMPLETED

My online mafia game: http://www.thecartelproject.com - players wanted!

Image Meh, i don't give a damn... Dumb ass!
User avatar
Ruffsta
 
Posts: 479
Joined: Sat Nov 28, 2009 6:08 am
Location: USA
Current Project: Potion Frenzy & not saying

Re: scoring issue...

Postby Metatarsals » Fri Mar 12, 2010 7:42 pm

What code is in your 'Draw Health' action?

Output text 1;0;0;Health:
Draw Variable 1;7,0,Health //Drawn 7 spaces ahead of the beginning of where you output the word "health:" so it will appear after the colon eg; Health:100
Building an Engine
User avatar
Metatarsals
 
Posts: 741
Joined: Sun Jul 26, 2009 5:38 pm
Location: Where Leprachauns doth lie
Current Project: PacMan E [Beta]

Re: scoring issue...

Postby Ruffsta » Fri Mar 12, 2010 7:49 pm

Code: Select all
Draw Health 1;77;6;Health
If Stylus.Newpress
If Sprite Touched 0
Increment Health 20;-
End If
End If
BananaCraze - COMPLETED
MasterMind - COMPLETED

My online mafia game: http://www.thecartelproject.com - players wanted!

Image Meh, i don't give a damn... Dumb ass!
User avatar
Ruffsta
 
Posts: 479
Joined: Sat Nov 28, 2009 6:08 am
Location: USA
Current Project: Potion Frenzy & not saying

Re: scoring issue...

Postby Metatarsals » Fri Mar 12, 2010 8:11 pm

You pasted your code over again, that is no help whatsoever, replace your draw health line with the two I posted in my last post, when you see it working, change the position the text is output.

If you draw a variable, you draw its value not its name. To show text, use the 'output text' action, and draw the value you wish to show afterwards. You output text and draw variables using tiles not pixels for distances.
(0-31 horizontally, 0-23 vertically, each tile is an 8x8 square) -- (1,1) in tiles therefore = (8,8) in pixels
Building an Engine
User avatar
Metatarsals
 
Posts: 741
Joined: Sun Jul 26, 2009 5:38 pm
Location: Where Leprachauns doth lie
Current Project: PacMan E [Beta]

Re: scoring issue...

Postby Ruffsta » Fri Mar 12, 2010 8:23 pm

sorry, i don't get it - can you use my code as example please?


i am surprised that there isn't a clear scoring/health tutorial... i've looked, but none i seen do what i want exactly
BananaCraze - COMPLETED
MasterMind - COMPLETED

My online mafia game: http://www.thecartelproject.com - players wanted!

Image Meh, i don't give a damn... Dumb ass!
User avatar
Ruffsta
 
Posts: 479
Joined: Sat Nov 28, 2009 6:08 am
Location: USA
Current Project: Potion Frenzy & not saying

Re: scoring issue...

Postby Metatarsals » Fri Mar 12, 2010 8:39 pm

Your code;

Draw Health 1;77;6;Health // DELETE this bit
If Stylus.Newpress
If Sprite Touched 0
Increment Health 20;-
End If
End If

Change to this:

Output Text 1;0;0;Health: // Newly added
Draw Variable 1;7;0;Health //Newly added
If Stylus.Newpress
If Sprite Touched 0
Increment Health 20;-
End If
End If

Output Text draws writing on the screen, in this case "Health:" beacuse thats what I told it to draw in the action
Draw Variable draws a variable, in this case 'Health' which is a pre-defined variable in DSGM

In your code, you told it to draw health at 'what you THOUGHT' was 77 pixels along the screen and 6 pixels down, BUT drawing text and numbers on the DS works by "Tiles" not pixels. So 77 TILES along is way off screen! This is because each tile is an 8x8 pixel square, the DS has a screen size of 256 pixels across (horizontally, X) and 192 down (vertically, Y), which equates to 32x24 tiles.
The tile system has a base number of 0, so the first tile is tile 0, the tenth therefore is 9 and so on. So the tiles range from 0-31 (32 tiles horizontally) by 0-23 (24 tiles verticaly)
Building an Engine
User avatar
Metatarsals
 
Posts: 741
Joined: Sun Jul 26, 2009 5:38 pm
Location: Where Leprachauns doth lie
Current Project: PacMan E [Beta]

Re: scoring issue...

Postby Ruffsta » Fri Mar 12, 2010 8:49 pm

1.)nothing happened after i clicked the sprite...
2.) you have the word "Health" at the top and the number 0 like 2 rows below - not side by side like i am looking for:



Health: 100 //is what i am looking for

you have this:

Health:

0
BananaCraze - COMPLETED
MasterMind - COMPLETED

My online mafia game: http://www.thecartelproject.com - players wanted!

Image Meh, i don't give a damn... Dumb ass!
User avatar
Ruffsta
 
Posts: 479
Joined: Sat Nov 28, 2009 6:08 am
Location: USA
Current Project: Potion Frenzy & not saying

Re: scoring issue...

Postby Metatarsals » Fri Mar 12, 2010 9:02 pm

You did something wrong on your own. My code works perfectly. See below;

Capture.PNG
See!
Capture.PNG (7.87 KiB) Viewed 68 times


And nothing happening on touching the sprite is not my fault. To fix it, remove the increment variable bit, and the If stylus.newpress. The stylus is checked to be touching the sprite with the If sprite touched action... Change to;


Output Text 1;0;0;Health:
Draw Variable 1;7;0;Health
If Sprite Touched 0
Set Variable; Health; Health - 20 //Changed to this from the increment variable action
End If //One End If has been removed
Building an Engine
User avatar
Metatarsals
 
Posts: 741
Joined: Sun Jul 26, 2009 5:38 pm
Location: Where Leprachauns doth lie
Current Project: PacMan E [Beta]

Re: scoring issue...

Postby Ruffsta » Fri Mar 12, 2010 10:31 pm

well, i want the sprite to be press not just touched...


35 sprites... each one to be pressed

the reason for this is because i don't want the end user to simply take the stylus and just rub the sprites - that would be like a scratch ticket type of thing - where as i want the user to actually tap each sprite.
BananaCraze - COMPLETED
MasterMind - COMPLETED

My online mafia game: http://www.thecartelproject.com - players wanted!

Image Meh, i don't give a damn... Dumb ass!
User avatar
Ruffsta
 
Posts: 479
Joined: Sat Nov 28, 2009 6:08 am
Location: USA
Current Project: Potion Frenzy & not saying

Re: scoring issue...

Postby Metatarsals » Sat Mar 13, 2010 12:28 am

Search "If Stylus Released Over Sprite" action. Makes sure the whole tap begins and ends on the sprite for the following code to be processed.
Building an Engine
User avatar
Metatarsals
 
Posts: 741
Joined: Sun Jul 26, 2009 5:38 pm
Location: Where Leprachauns doth lie
Current Project: PacMan E [Beta]


Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests