Hello! As you can see a need help with something.
I am trying to figure out how to do this:
- a player collision line that will check wether it is touching the top, bottom, or either side of a block.
- when right mouse is clicked, the block will be placed wherever the collision line is touching a block (above, below, or on either side).
I am having trouble trying to do this, so if anyone can help, it would be greatly appreciated! Thanks.
- Game Maker Community
- → Viewing Profile: Topics: theepicgeno
theepicgeno
Member Since 12 Feb 2012Offline Last Active Today, 06:50 AM
About Me
My favorite color is green. THATS ALL YOU NEED TO KNOW O.o
Community Stats
- Group GMC Member
- Active Posts 520
- Profile Views 7441
- Member Title We Are Epic
- Age 17 years old
- Birthday January 17, 1996
-
Gender
Male
-
Location
My House, CA
-
Interests
My interests are:
- GameMaker
- Art
- Math
- Video Games (Minecraft) -
Version
GM8.1
45
Mostly Harmless
Latest Visitors
Topics I've Started
Placing Blocks Via Collision Line.
17 April 2013 - 06:47 PM
Gm4Mac Publish Button Wont Publish?
11 April 2013 - 04:18 AM
When i publish my game, i login and it tells me to keep logging in. I can never get to the upload page.
Have any idea whats wrong?
Saving Sprite Name In An Ini File, With An Array.
24 February 2013 - 02:58 AM
Spoiler
if file_exists("inv.ini")
{
ini_open("inv.ini")
curr[0,0]=ini_read_string("Hotbar","Slot 0","")
curr[0,1]=ini_read_string("Hotbar","Slot 0a","")
curr[0,2]=ini_read_real("Hotbar","Slot 0b",0)
curr[1,0]=ini_read_string("Hotbar","Slot 1","")
curr[1,1]=ini_read_string("Hotbar","Slot 1a","")
curr[1,2]=ini_read_real("Hotbar","Slot 1b",0)
curr[2,0]=ini_read_string("Hotbar","Slot 2","")
curr[2,1]=ini_read_string("Hotbar","Slot 2a","")
curr[2,2]=ini_read_real("Hotbar","Slot 2b",0)
curr[3,0]=ini_read_string("Hotbar","Slot 3","")
curr[3,1]=ini_read_string("Hotbar","Slot 3a","")
curr[3,2]=ini_read_real("Hotbar","Slot 3b",0)
curr[4,0]=ini_read_string("Hotbar","Slot 4","")
curr[4,1]=ini_read_string("Hotbar","Slot 4a","")
curr[4,2]=ini_read_real("Hotbar","Slot 4b",0)
curr[5,0]=ini_read_string("Hotbar","Slot 5","")
curr[5,1]=ini_read_string("Hotbar","Slot 5a","")
curr[5,2]=ini_read_real("Hotbar","Slot 5b",0)
ini_close()
}
else
{
curr[0,0]=spr_none
curr[0,1]=""
curr[0,2]=0
curr[1,0]=spr_none
curr[1,1]=""
curr[1,2]=0
curr[2,0]=spr_none
curr[2,1]=""
curr[2,2]=0
curr[3,0]=spr_none
curr[3,1]=""
curr[3,2]=0
curr[4,0]=spr_none
curr[4,1]=""
curr[4,2]=0
curr[5,0]=spr_none
curr[5,1]=""
curr[5,2]=0
}The code above is in the create event of the hot bar.
The code below is in the room end event of the hot bar.
Spoiler
ini_open("inv.ini")
ini_write_string("Hotbar","Slot 0",curr[0,0])
ini_write_string("Hotbar","Slot 0a",curr[0,1])
ini_write_real("Hotbar","Slot 0b",curr[0,2])
ini_write_string("Hotbar","Slot 1",curr[1,0])
ini_write_string("Hotbar","Slot 1a",curr[1,1])
ini_write_real("Hotbar","Slot 1b",curr[1,2])
ini_write_string("Hotbar","Slot 2",curr[2,0])
ini_write_string("Hotbar","Slot 2a",curr[2,1])
ini_write_real("Hotbar","Slot 2b",curr[2,2])
ini_write_string("Hotbar","Slot 3",curr[3,0])
ini_write_string("Hotbar","Slot 3a",curr[3,1])
ini_write_real("Hotbar","Slot 3b",curr[3,2])
ini_write_string("Hotbar","Slot 4",curr[4,0])
ini_write_string("Hotbar","Slot 4a",curr[4,1])
ini_write_real("Hotbar","Slot 4b",curr[4,2])
ini_write_string("Hotbar","Slot 5",curr[5,0])
ini_write_string("Hotbar","Slot 5a",curr[5,1])
ini_write_real("Hotbar","Slot 5b",curr[5,2])
ini_close()Now, ill explain to you all what happens.
When i collect items all of the correct sprite come up (example picture):

Then i close the game, and open the "inv.ini" file (example picture):

Now above, you can see that Slot [0-5]a/b are working, but not Slot [0-5] (the sprite holder array).
Below is what it looks like then i open the game back up (example picture):

And when i place the blocks, it places the block that was there when i closed the game. Its really killing me that i can't figure out this problem... Any ideas on how to fix this?
Sprite Still Showing.
18 February 2013 - 03:31 AM
This code is in the Global Right Pressed event for objPlayer. This is also the main block placement code.
(kinda messy)
Its basically saying that if objHotbar.curr(1-6)[2] is equal to 0, the sprite would not be shown. But it still shows even when objHotbar.curr(1-6)[2] is equal to 0. Then once i click again, it disappears.
I know that the s_Block_* scripts are not the cause of it, because that script only chooses the block that will be placed.
If anyone can help me in anyway, that would be great!
I even added a nice image:
(kinda messy)
Spoiler
if !collision_point(mouse_x,mouse_y,obj_block,1,1) and distance_to_point(mouse_x,mouse_y)<60
{
if objHotbar.select=0
{
if objHotbar.curr1[2]>0
{
objHotbar.curr1[2]-=1
s_Block_1()
instance_create(mouse_x,mouse_y,i)
}
else
{
objHotbar.curr1[0]=spr_none
objHotbar.curr1[1]=""
objHotbar.curr1[2]=0
}
}
if objHotbar.select=1
{
if objHotbar.curr2[2]>0
{
objHotbar.curr2[2]-=1
s_Block_2()
instance_create(mouse_x,mouse_y,i)
}
else
{
objHotbar.curr2[0]=spr_none
objHotbar.curr2[1]=""
objHotbar.curr2[2]=0
}
}
if objHotbar.select=2
{
if objHotbar.curr3[2]>0
{
objHotbar.curr3[2]-=1
s_Block_3()
instance_create(mouse_x,mouse_y,i)
}
else
{
objHotbar.curr3[0]=spr_none
objHotbar.curr3[1]=""
objHotbar.curr3[2]=0
}
}
if objHotbar.select=3
{
if objHotbar.curr4[2]>0
{
objHotbar.curr4[2]-=1
s_Block_4()
instance_create(mouse_x,mouse_y,i)
}
else
{
objHotbar.curr4[0]=spr_none
objHotbar.curr4[1]=""
objHotbar.curr4[2]=0
}
}
if objHotbar.select=4
{
if objHotbar.curr5[2]>0
{
objHotbar.curr5[2]-=1
s_Block_5()
instance_create(mouse_x,mouse_y,i)
}
else
{
objHotbar.curr5[0]=spr_none
objHotbar.curr5[1]=""
objHotbar.curr5[2]=0
}
}
if objHotbar.select=5
{
if objHotbar.curr6[2]>0
{
objHotbar.curr6[2]-=1
s_Block_6()
instance_create(mouse_x,mouse_y,i)
}
else
{
objHotbar.curr6[0]=spr_none
objHotbar.curr6[1]=""
objHotbar.curr6[2]=0
}
}
}Its basically saying that if objHotbar.curr(1-6)[2] is equal to 0, the sprite would not be shown. But it still shows even when objHotbar.curr(1-6)[2] is equal to 0. Then once i click again, it disappears.
I know that the s_Block_* scripts are not the cause of it, because that script only chooses the block that will be placed.
If anyone can help me in anyway, that would be great!
I even added a nice image:
How many Quotes can a Quote Quote?
14 February 2013 - 06:11 AM
The title says it all!
Just keep quoting the person above you.
You can't double post, and you must have something to say below the quote.
OK GO!
Just keep quoting the person above you.
You can't double post, and you must have something to say below the quote.
OK GO!
- Game Maker Community
- → Viewing Profile: Topics: theepicgeno
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content

