Game Maker Discussions
Moderators: ~xpr'd~, tyteen4a03, Stinky, Emerald141, Qloof234, jdl
- Guppy Star
- Rainbow Master
- Posts: 919
- Joined: Sat Oct 16, 2010 7:20 am
Game Maker Discussions
How do you make gmk recognize that a sprite has 2 or more subimages?
If anyone knows, please do it with my attachments...
Edited by tyteen: made this the topic for GM discussions
If anyone knows, please do it with my attachments...
Edited by tyteen: made this the topic for GM discussions
- Attachments
-
- Enemy Shooter.bmp (6.05 KiB) Viewed 3817 times
-
- Coin.PNG (10.73 KiB) Viewed 3817 times
-
- Fire.PNG (17.08 KiB) Viewed 3817 times
-
- Diamond.png (10.52 KiB) Viewed 3817 times
Guppy star: To use more than 1 image to make subimages you have to go to
"Edit Sprite/File/Create from strip"
"Edit Sprite/File/Create from strip"
Click here to go to WA:The Dark Abysm topic (Postponed until Wonderland Fangame is made).
- Guppy Star
- Rainbow Master
- Posts: 919
- Joined: Sat Oct 16, 2010 7:20 am
are you making a Game Maker game?
Edited by tyteen: merged post
Edited by tyteen: merged post
Click here to go to WA:The Dark Abysm topic (Postponed until Wonderland Fangame is made).
- jozsefkoma
- Rainbow Star
- Posts: 1460
- Joined: Tue Dec 23, 2008 5:45 pm
-
- Rainbow AllStar
- Posts: 4548
- Joined: Fri Dec 26, 2008 4:56 pm
- DEEMAN223344
- Rainbow MegaStar
- Posts: 3145
- Joined: Tue Dec 04, 2007 8:07 pm
You could use something likeEmerald141 wrote:I have a question about Game Maker myself. I'm trying to do something where an object displays one out of 35 sprites randomly. If that's possible, how can I do it?
sprite_index = choose(sprite1,sprite2,sprite3,...)
The choose function chooses one of the options randomly but it can only have up to 16 options... I'm not sure if putting another choose function inside the choose function would work but you could try that for it to choose out of 35 sprites.
dlcs18
- Guppy Star
- Rainbow Master
- Posts: 919
- Joined: Sat Oct 16, 2010 7:20 am
- boywhoflies
- Rainbow Spirit Chaser
- Posts: 5510
- Joined: Thu Jun 26, 2008 3:16 pm
This only works if they all only have 1 subimage.Emerald141 wrote:I have a question about Game Maker myself. I'm trying to do something where an object displays one out of 35 sprites randomly. If that's possible, how can I do it?
Put them all into one sprite, all one subimage, then for the object you want it to happen on put this code in the create event:
image_speed=0;
image_index=random(35);
- Guppy Star
- Rainbow Master
- Posts: 919
- Joined: Sat Oct 16, 2010 7:20 am
- Guppy Star
- Rainbow Master
- Posts: 919
- Joined: Sat Oct 16, 2010 7:20 am
- boywhoflies
- Rainbow Spirit Chaser
- Posts: 5510
- Joined: Thu Jun 26, 2008 3:16 pm
- Guppy Star
- Rainbow Master
- Posts: 919
- Joined: Sat Oct 16, 2010 7:20 am
Is easy, only use views, can't explain it too detaily now, I look tired.
Click here to go to WA:The Dark Abysm topic (Postponed until Wonderland Fangame is made).
- Guppy Star
- Rainbow Master
- Posts: 919
- Joined: Sat Oct 16, 2010 7:20 am
- Master Wonder Mage
- Rainbow SuperStar
- Posts: 2124
- Joined: Sat Jan 08, 2011 5:26 pm
- jozsefkoma
- Rainbow Star
- Posts: 1460
- Joined: Tue Dec 23, 2008 5:45 pm
- boywhoflies
- Rainbow Spirit Chaser
- Posts: 5510
- Joined: Thu Jun 26, 2008 3:16 pm
- Guppy Star
- Rainbow Master
- Posts: 919
- Joined: Sat Oct 16, 2010 7:20 am
- boywhoflies
- Rainbow Spirit Chaser
- Posts: 5510
- Joined: Thu Jun 26, 2008 3:16 pm
- Master Wonder Mage
- Rainbow SuperStar
- Posts: 2124
- Joined: Sat Jan 08, 2011 5:26 pm
- boywhoflies
- Rainbow Spirit Chaser
- Posts: 5510
- Joined: Thu Jun 26, 2008 3:16 pm
I'm too lazy to explain so here's the info on one of my text objects. It's The Apple saying "Nice Day." It's called 1. 2 is the next text. The first one causes a error, so set display error messages to off.
Sprite: Text Box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>
Create Event:
set variable type_varible to 1
execute code:
text="Nice day."
text_length=string_length(text)
next=false
step_passed=false
Step Event:
execute code:
speech=string_copy(text,1,type_varible);
if type_varible is not equal to text_length
set variable type_varible relative to 1
play sound Letter; looping: false
else
set variable next to true
End Step Event:
set variable step_passed to true
Draw Event:
set the drawing color to 0
set the font for drawing text to Name and align left
execute code:
draw_sprite(sprite_index,image_index,x,y)
draw_sprite(spr_theapple,image_index,x+4,y+4)
draw_text(x+36,y+4,"The Apple")
set the font for drawing text to Text and align left
execute code:
draw_text_ext(x+4,y+36,speech,16,252)
if type_varible is equal to text_length
at relative position (0,0) draw image -1 of sprite Text Arrow
Key Press Event for <Space> Key:
if step_passed is equal to false
exit this event
if next is equal to true
play sound New Bubble; looping: false
create instance of object 2 at relative position (0,0)
destroy the instance
else
set variable type_varible to text_length
Sprite: Text Box
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>
Create Event:
set variable type_varible to 1
execute code:
text="Nice day."
text_length=string_length(text)
next=false
step_passed=false
Step Event:
execute code:
speech=string_copy(text,1,type_varible);
if type_varible is not equal to text_length
set variable type_varible relative to 1
play sound Letter; looping: false
else
set variable next to true
End Step Event:
set variable step_passed to true
Draw Event:
set the drawing color to 0
set the font for drawing text to Name and align left
execute code:
draw_sprite(sprite_index,image_index,x,y)
draw_sprite(spr_theapple,image_index,x+4,y+4)
draw_text(x+36,y+4,"The Apple")
set the font for drawing text to Text and align left
execute code:
draw_text_ext(x+4,y+36,speech,16,252)
if type_varible is equal to text_length
at relative position (0,0) draw image -1 of sprite Text Arrow
Key Press Event for <Space> Key:
if step_passed is equal to false
exit this event
if next is equal to true
play sound New Bubble; looping: false
create instance of object 2 at relative position (0,0)
destroy the instance
else
set variable type_varible to text_length
You can make an object indestructible by puttingGuppy Star wrote:How to make powderkeg type objects without destroying the wall?
Code: Select all
instance_create(x,y,object_index(self))
dlcs18
- MyNameIsKooky
- Rainbow Spirit Master
- Posts: 9711
- Joined: Mon Dec 01, 2008 10:18 pm
- MyNameIsKooky
- Rainbow Spirit Master
- Posts: 9711
- Joined: Mon Dec 01, 2008 10:18 pm